Oracle order by case when 多条件排序

 

ORACLE sql 排序 根据两个条件排序,根据id号由小到大排序,同时country字段是北京的排最前面前面,其次上海,。。大连,最后是其他城市,怎么写?

 

写法如下:
select * from provice
order by (case when country='北京' then 0
when country='上海' then 1
when country='广东' then 2
when country='深圳' then 3
when country='杭州' then 4
when country='大连' then 5
else 6 end) ,id desc

posted on 2016-03-05 00:22  struggle_beiJing  阅读(3825)  评论(0编辑  收藏  举报

导航