MySQL错误:ERROR 1221 (HY000): Incorrect usage of UNION and ORDER BY
来源:互联网 发布:淘宝店标尺寸是多少 编辑:程序博客网 时间:2024/05/16 19:25
MySQL版本:Ver 14.14 Distrib 5.1.61, for redhat-linux-gnu (x86_64)
使用union将两个子查询纵向合并后插入到数据表出现了上面的错误,sql语句如下:
insert into lvlvtest1 select * from lvlvtest order by dwMsgTime desc limit 1 union select * from lvlvtest order by dwMsgTime asc limit 1;
将上面的子查询分别加上括号就OK了,无需给子查询加上别名,修改如下:
insert into lvlvtest1 (select * from lvlvtest order by dwMsgTime desc limit 1) union (select * from lvlvtest order by dwMsgTime asc limit 1);
成功!!!
1 0
- MySQL错误:ERROR 1221 (HY000): Incorrect usage of UNION and ORDER BY
- MYSQL之union和order by分析([Err] 1221 - Incorrect usage of UNION and ORDER BY)
- ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
- MySQL的ERROR 1366 (HY000): Incorrect string value错误解决
- MySQL中出现编码错误问题:ERROR 1366 (HY000): Incorrect string value:
- iformix union和order by error -374
- MYSQL之union和order by分析([Err] 1221
- mysql中的union和order by、limit
- Mysql union order by 总结一下
- mysql中的union和order by、limit
- 解决MySQL里的ERROR 1366 (HY000): Incorrect string value
- 解决MySql 报错:ERROR 1366 (HY000): Incorrect string value....
- MySQL里的ERROR 1366 (HY000): Incorrect string value问题
- Union与order by
- ORACLE union order by
- Mysql错误 ERROR 1366 (HY000)的解决方法
- MYSQL ERROR 1130 (HY000) 的错误解决方案
- MYSQL ERROR 1130 (HY000) 的错误解决方案
- UIView结构
- SVG Shapes
- Docker命令行探秘
- Eclipse中调试Android技巧
- android学习笔记之GPS定位
- MySQL错误:ERROR 1221 (HY000): Incorrect usage of UNION and ORDER BY
- Java Keystore 与Openssl Pem 的转换
- Java中的泛型<T>类与方法
- sqlplus中乱码解决方案
- 华为OJ 初级:提取不重复的整数
- 通信组件之Intent的复杂数据的传递
- Android 之HierarchyViewer - 4939
- Collections.sort()方法对象排序
- CI框架搜索分页