SQL 通过order by 自定义排序规则
现需按val3,val1,val2的顺序排序,直接操作的SQL语句
在Sybase中,使用以下语句实现
- SELECT table.col FROM table
- ORDER BY CASE table.col WHEN 'val3' THEN 1 WHEN 'val1' THEN 2 WHEN 'val2' THEN 3 END
END
2012-11-14
转载于:https://blog.51cto.com/snowdream/1059930