MySQL的union和order by一起使用的问题
来源:互联网 发布:洋葱英语软件 编辑:程序博客网 时间:2024/06/05 09:44
想使用下面的sql逻辑,会报错,
[Err] 1221 - Incorrect usage of UNION and ORDER BY
SELECT DISTINCT APP_NAME FROM tm_platform_usr_reld WHERE app_id <> 'APP_ALL' AND APP_NAME <> '' ORDER BY NEW_USR_CNT DESCUNION SELECT DISTINCT app_name FROM tm_platform_req_reld WHERE app_id <> 'APP_ALL' AND APP_NAME <> ''
可以变通一下,
SELECT *FROM ( SELECT DISTINCT APP_NAME FROM tm_platform_usr_reld WHERE app_id <> 'APP_ALL' AND APP_NAME <> '' ORDER BY NEW_USR_CNT DESC ) AS aUNION SELECT DISTINCT app_name FROM tm_platform_req_reld WHERE app_id <> 'APP_ALL' AND APP_NAME <> ''
这样就可以使用了
阅读全文
0 0
- MySQL的union和order by一起使用的问题
- MySQL中union和order by一起使用的方法
- union 和order by 连接使用报错的问题
- oracle order by与union一起使用的用法
- oracle order by 和union all(union)的使用
- [mysql]union中各自order by的问题
- union all和order by一起使用出问题
- 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一起使用
- ORACLE数据库UNION集合ORDER BY 和 ROWNUM的使用
- UNION ALL ORDER BY的问题
- UNION中ORDER By的使用
- UNION中ORDER By的使用
- union中order by的使用
- UNION中ORDER By的使用
- css中的三个属性的区别 第九节
- RxPermission和Rx2.0的使用
- 断点传输(总结)
- extern外部方法使用
- 用CoacoPod安装Swift第三方框架遇到的坑
- MySQL的union和order by一起使用的问题
- mybatis 自定义typehandler,转换特定字段
- 沃趣科技与Mellanox联合打造证券行业高性能及同城双活数据库云平台
- imagemagick 图片叠加-compose模式详解
- Codeforces 1B Spreadsheets(模拟+26进制思想)
- POJ 2799 IP Networks 笔记
- (13)数组操作:遍历、输出最大值、冒泡排序、选择排序,java已有的排序方法、折半查找
- 线程应用
- Servlet工作原理