I have a table as below,
ID Description
--------------------
1 Bacteria
2 Cell Lines
3 Compounds
4 Virus
5 Others
6 AntiBody
What I want is a single SQL query, ordered alphabetically but have 'Other' (ID 5) as the last record. Is that even possible?
Any help would greatly appreciated. Thanks.
SELECT ID, Description
FROM YourTable
ORDER BY CASE WHEN ID = 5 THEN 1 ELSE 0 END,
Description
SELECT ID, Description
FROM yourtable
ORDER BY CASE WHEN Description = 'Others' THEN 1 ELSE 0 END, Description
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