I have a table that I select data from with a column called parent that's of unsigned integer type.
It has numbers from 0 to 12.
I want to select * from table order by parent asc, but with one exception: place the 0 at the end of the select so it would be like 1,2,3,4,5,6,7,8,9,0.
Is this possible with a single select in MySQL please?
I would do something like this:
select *
from your_table
order by (parent != 0) desc, parent 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