Reputation: 2267
I want to sort dates in MYSQL
in a way such that, future dates will be sorted first by in ASC order and, then then old dates last in DESC order. Here is the query I used to do, but both date types (future and old) are sorted out in ASC order. How can I fix this?
SELECT id, end_date FROM employee
ORDER BY CASE WHEN DATE(date) > DATE(NOW())
THEN 0
ELSE 1 END, date ASC
Upvotes: 1
Views: 557