Oracle union all和order by一起使用
来源:互联网 发布:网络剧校花的贴身高手2 编辑:程序博客网 时间:2024/06/06 04:37
有时候,我们会将进过排序(order by)后的结果集与其他经过排序的结果集进行合并(union or union all)
比如:
select * from tb where length(id)=5 order by id desc
union all
select * from tb where length(id)=10 order by id asc
比如:
select * from tb where length(id)=5 order by id desc
union all
select * from tb where length(id)=10 order by id asc
通常情况下,上面的查询将会得到下面的错误提示:ORA-00933: SQL command not properly ended 错误指向union关键字这里
解决办法:
select * from (
select col_1,col_2,col_3,status
from t
where status >= 0
order by status)
union all
select * from (
select col_1,col_2,col_3,status
from t
where status < 0
order by status)
阅读全文
0 0
- oracle union all和order by一起使用
- oracle union all和order by一起使用
- Oracle union all和order by一起使用
- Oracle union all和order by一起使用
- Oracle union all和order by一起使用
- union all和order by一起使用出问题
- oracle order by 和union all(union)的使用
- UNION/UNION ALL和order by 连接使用
- oracle order by与union一起使用的用法
- MySQL中union和order by一起使用的方法
- MySQL的union和order by一起使用的问题
- UNION ALL 和 Order by 同用
- union 或者 union all 与 order by 的联合使用
- ORACLE数据库UNION集合ORDER BY 和 ROWNUM的使用
- ORACLE union order by
- union与union all与order by
- GROUP BY 和 ORDER BY一起使用
- GROUP BY 和 ORDER BY一起使用
- 7039s芯片(F4plus、M3 4K、M6 4K、F5PLUS、A1-4K)开机不进主界面的解决办法
- easyui前台分页
- docker容器迁移问题
- 织梦教程:如何修改dedecms系统数据库表前缀?
- 高效使用Eclipse开发微服务-环境准备(一)
- Oracle union all和order by一起使用
- linux应用之wget命令详解
- 剪布条(快速AC代码)
- 函数指针
- jqgrid 样板
- 友盟推送设备描述红色,提示筛选信息为空的解决方法
- Redis操作命令总结
- 接口+GUI-第十天
- SGU 326 Perspective ( 网络流 )