How do I create a sql query that orders everything ascending that is not 0, followed by the 0's?
So the column has data like:
col
----
2
4
0
7
0
8
...and I want the query to return:
col
----
2
4
7
8
0
0
Thanks!
Select ...
From MyTable
Order By Case When Col = 0 Then 1 Else 0 End Asc, Col Asc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With