I have a table containing a varchar column for months. Because of some reasons I have to save Persian months in it like Farvardin , Ordibehesh , ... . Now I want to select some rows from that table and I want to order my rows by months. what should I do ? Please just use SQL commands.
You need to create a custom sort order with:
SELECT *
FROM months
ORDER BY CASE
WHEN monthName = 'Farvardin' THEN '1'
WHEN monthName = 'Ordibehesh' THEN '2'
...
ELSE monthName END 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