i have a table like this :
key value rating
1 1 1
0 0 3
0 1 2
First i want to order the table by rating column in descending order and for those rows where value column is 1 , it should be ordered by key in descending order. So the resulting table has to be like this:
key value rating
0 0 3
1 1 1
0 1 2
i have tried this :
SELECT * FROM `table` ORDER BY CASE `value` WHEN 1 THEN `key`
END
`table`.`pair` desc
value=0andrating=2?