zun*_*arz 0 sql oracle oracle11g
使用Oracle 11g
我想要一个以其他方式排序的表的单个异常
select fruit as popluar_choices
from menu
order by fruit /* Exception put 'grapefruit' at top of list */
Run Code Online (Sandbox Code Playgroud)
期望的结果
popular_choices
-----------
grapefruit
apple
fig
kiwi
lemon
pear
Run Code Online (Sandbox Code Playgroud)
它类似于这篇文章: 如何应用非标准SQL列排序顺序?
select fruit as popluar_choices
from menu
order by case fruit when 'grapefruit' then 0
else 1
end,
fruit
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
736 次 |
| 最近记录: |