oracle自定义排序例如(AAA>AA>A>B>C>D)

select x.INNER_RATE,row_number() over(order by 
CASE when x.inner_rate='AAA' then 0 END,
CASE when x.inner_rate='AA' then 1 END, 
  CASE when x.inner_rate='A' then 3 END,
  CASE when x.inner_rate='B' then 4 END,
  CASE when x.inner_rate='C' then 5 END,
  CASE when x.inner_rate='D' then 6 END,
   END desc,x.id) num from t_table x ;

 

posted @ 2021-09-03 16:00  大科比的小弟  阅读(443)  评论(0编辑  收藏  举报