标签:mysql-查询语句
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...
错误代码: 1242
Subquery returns more than 1 row
执行耗时 : 0.009 sec
传送时间 : 0.002 sec
总耗时 : 0.012 sec
在编写查询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 t0
on t0.id = t.stuNo
查询出num是多条数据,而外层查询结果是要求num为一条数据
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 t0
on t0.id = t.stuNo
版权声明:本文为博主原创文章,未经博主允许不得转载。
错误代码: 1242 Subquery returns more than 1 row
标签:mysql-查询语句
原文地址:http://blog.csdn.net/you23hai45/article/details/46835685