MySQL ORDER BY ASC with NULL values last
Posted: 02 Jul 2015, 17:45
Hello
I want to make a Select SQL query that sorts ascending by a column, but the rows with NULL values to come last.
This is the query I use (but the NULL values not come last)
Is it possible to order by ascending with nulls at the end of the output?
I want to make a Select SQL query that sorts ascending by a column, but the rows with NULL values to come last.
This is the query I use (but the NULL values not come last)
Code: Select all
$sql = "SELECT * FROM mp_tab WHERE col < 50 ORDER BY col ASC";