错误代码: 1242 Subquery returns more than 1 row
来源:互联网 发布:bl网络剧推荐2016 编辑:程序博客网 时间:2024/04/29 03:41
1. 错误描述
1 queries executed, 0 success, 1 errors, 0 warnings查询:SELECT t.id, DATE_FORMAT( t.statisTime, '%Y-%m-%d %H:%i:%s' ) statisTime, (SELECT `id` FROM t_truck_info WHERE id = t.plateId...错误代码: 1242Subquery returns more than 1 row执行耗时 : 0.009 sec传送时间 : 0.002 sec总耗时 : 0.012 sec
2. 错误原因
在编写查询SQL语句时,其中有个字段是从另一张表里获取
select t.id,(select num from t_user_info where id = stuNo) as amount from t_stu_info t left join t_user_info t0on t0.id = t.stuNo
查询出num是多条数据,而外层查询结果是要求num为一条数据
3. 解决办法
select t.id,(select sum(num) from t_user_info where id = stuNo) as amount from t_stu_info t left join t_user_info t0on t0.id = t.stuNo
1 0
- 错误代码: 1242 Subquery returns more than 1 row
- Subquery returns more than 1 row
- MYSQL --Subquery returns more than 1 row
- MySQL:Subquery returns more than 1 row
- [Err] 1242 - Subquery returns more than 1 row
- 报错 MYSQL --Subquery returns more than 1 row
- 【MySQL】Subquery returns more than 1 row 解决方案
- 关于mysql错误:Subquery returns more than 1 row
- ORA-01427:single-row subquery returns more than one row
- ORA-01427single-row subquery returns more than one
- MYSQL --Subquery returns more than 1 row查询结果多于一行
- MYSQL --Subquery returns more than 1 row查询结果多于一行
- 报错java.sql.SQLException: Subquery returns more than 1 row
- MYSQL --Subquery returns more than 1 row查询结果多于一行
- MYSQL --Subquery returns more than 1 row查询结果多于一行
- MYSQL --Subquery returns more than 1 row查询结果多于一行
- SQL Error: ORA-01427: single-row subquery returns more than one row
- Result consisted of more than one row
- 如何插入公式
- 关于树的总结从二叉树->二叉搜索树->平衡二叉树->红黑树->B树与B+树
- shell排序
- Trapping Rain Water Array+技巧
- Base Function
- 错误代码: 1242 Subquery returns more than 1 row
- Base Class
- codeforces 7 A. Kalevitch and Chess
- JavaIO流(二)
- 使用Cocos2d-x-3.6创建Lua项目Cocos Code IDE V1.2可调试
- 【Cocos2d-x 游戏开发】 2 --- Button、CCMoveBy
- POJ 2155 Matrix
- java中接口和抽象类的区别和介绍
- 如何检测节点网络中是否存在闭环之java实现