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 ;

 

上一篇:Mysql的外键约束、内外连接查询以及锁


下一篇:大家信夫资信:企业信用资质等级证书”有什么用?