Answer the question
In order to leave comments, you need to log in
How to perform multiple sorting of a table with null values?
Greetings! There is a table where sorting is done by two values
SELECT * FROM mytable
ORDER BY photo DESC, stats DESC
Answer the question
In order to leave comments, you need to log in
The most delicate thing is to first find out if the site whose content you are trying to read works with the parameters you pass.
Also, a space in the address bar must be encoded as %20 (url_encode, read about it).
the most classic and for more advanced logic - order by case when stats is null then <largest or smallest value here> else stats end desc
well, or how to set it at the NULLS level in a number of sql dialects { FIRST | LAST}
or all sorts of hacks like order by -stats asc or just wrap it in isnull
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question