
I am totally lost in OrderBy clausules.
I need this result after ordering: ID's: 8, 5, 2, 1, 4, 6, 7, 3
Theese rules must be applicated in this order:
Is there any possibility to do this ordering?
Thank you all!
I would translate your requirement as:
order by
top3 desc,
top2 desc,
top1 desc,
nullif(`order`, 0) nulls last
The last criteria shorts by ascending order, while keeping nulls and 0 values last.
Please note that order is a reserved word in all SQL dialects, so not a good choice for a column name.
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