I have a column 'order' where I store articles and then show them in a specific order. I use enum type '0','1','2','3' with 0 as default. I need a query to order the result as this: 1, 2, 3, 0, 0, 0, 0 and so on with zeros. Is it possible?
Give this a try:
select * from table
order by val = '0', val
This will work even you add new values values to the enum later.
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