I have these rows in a table...
id task_type task_date
1 1 01/15/2010
2 2 01/18/2010
3 1 01/18/2010
4 2 01/16/2010
6 1 01/16/2010
8 1 01/17/2010
9 2 01/17/2010
and I want to order them in a particular way: when task_type=1 order by ASC and when task_type=2 order by DESC
id task_type task_date
1 1 01/15/2010
6 1 01/16/2010
8 1 01/17/2010
3 1 01/18/2010
2 2 01/18/2010
9 2 01/17/2010
4 2 01/16/2010
Is this even possible? I've been looking for conditional queries and all i can get is a syntax error...
This is the query that i cant make it work properly:
SELECT id, task_type, task_date
From Tasks
ORDER BY CASE WHEN task_type=1 THEN
task_type ASC, task_date ASC, hour ASC, priority DESC, id ASC
WHEN task_type=2 THEN
task_type ASC, task_date DESC, hour ASC, priority DESC, id ASC
END