+------+
| num |
+------+
| 1 |
| 2 |
| 3 |
| NULL |
| 5 |
| 6 |
+------+
This is table test.
select max(num) from test; ---> 6
How to write a SQL statement that
if NULL values exists –> output should be “OK”
if NULL values does not exist in this column –> output should be 6
I try many times but no luck. Any help?
It would be nice if the solution is ANSI SQL
Try this: http://www.sqlfiddle.com/#!2/dfcbd/2
This:
Outputs:
This:
Outputs: