1.自定义顺序
当我们希望将某个查询结果指定的显示顺序展示的时候
order by case when column1=1 then 0
case when column1=1 then 1
else 2 end
decode也可以解决类似

2.对于null值的排序
在Oracle中,进行Order by排序时缺省认为null是最大值,所以如果是ASC升序则被排在最后,而DESC降序则排在最前。
a) order by NVL(FIELD, '0') 当field列为null时则指定为0
b) order by column asc nulls first : null值始终放在最前面
c) order bu culumn desc nulls last : null值始终放在最后面

相关文章:

  • 2021-08-08
  • 2022-03-02
  • 2022-03-06
  • 2021-09-23
  • 2021-06-24
  • 2021-04-29
  • 2021-12-14
  • 2020-01-18
猜你喜欢
  • 2021-10-18
  • 2022-12-23
  • 2021-10-24
  • 2021-08-11
  • 2022-12-23
  • 2021-11-10
  • 2022-02-25
相关资源
相似解决方案