mysql order by null last code example
Example 1: mysql order by desc null last
SELECT * FROM user
ORDER BY COALESCE(name, 'zz') DESC
Example 2: mysql order by date asc null last
ORDER BY IF(ISNULL(my_field),1,0),my_field ASC
SELECT * FROM user
ORDER BY COALESCE(name, 'zz') DESC
ORDER BY IF(ISNULL(my_field),1,0),my_field ASC