开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜