ORDER BY place null values at end

admin

Administrator
Staff member
I am writing an application in which users will "Rank" records, and leave some of them blank. The blank records will have a NULL value in the MySQL db. When I SELECT the records, I would like them to display in the ranking order chosen by the user, followed by the NULL (not ranked) items. Right now, by default, all NULL values are displayed first, then the ranked items are displayed correctly. I'd like to display the NULL values of the ORDER BY clause last, instead of first.

ORDER BY rnk DESC will display the NULL values last, but the ranked items are not displayed 1-10, rather 10-1.

Thanks for any help..

Bruce
 
Back
Top