0
SELECT 'id'  FROM `table` WHERE `id` = 
(select min(`id`) FROM `table` where 
`id` < 1 and `ids` = 1)

id       ids
1         1
2         1
5         1
6         1

Result:

id = ''

I need to change id='' to id='n/a'

Mat
  • 202,337
  • 40
  • 393
  • 406
user1029691
  • 69
  • 1
  • 4

2 Answers2

1

If the query return a null result you can use COALESCE so :

SELECT COALESCE('id','N/A') FROM ...

OR if the return result is an empty string you can do :

SELECT CASE WHEN id = '' THEN 'N/A' ELSE id END FROM ...
aleroot
  • 71,077
  • 30
  • 176
  • 213
0

Another option would be: IFNULL

AlenBer
  • 738
  • 2
  • 8
  • 25