MySQL Forums
Forum List  »  Newbie

Re: ORDER BY that sorts NULLS last
Posted by: laptop alias
Date: May 09, 2008 01:46AM

For future reference, you can use this syntax to put NULLs at the bottom:

ORDER BY IF(ISNULL(my_field),1,0),my_field;

Options: ReplyQuote

Written By
Re: ORDER BY that sorts NULLS last
May 09, 2008 01:46AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.