How to do a special order clause in postgresql?
I have a result set like this: a b c
This result will be fixed each time. What I need to do is order the rows like this a c b. How can I开发者_开发百科 do that ?
SELECT value
FROM mytable
ORDER BY
CASE value WHEN 'a' THEN 1 WHEN 'c' THEN 2 WHEN 'b' THEN 3 END
精彩评论