I have one table for two different kind of news. I want to create a list of them ordered by a date which depends of the type of news, so I tried this:
SELECT * FROM my_table ORDER BY case type when 'news' then creation_date else 'events' then starting_date end desc;
What I want is to sort news by creation_date ASC
and events by starting_date DESC
. I tried to simply add
when 'news' then creation_date ASC else 'events' then starting_date DESC
but it doesn't work. Is it possible to do this?
Thank you.