Mysql ERROR 1242 (21000): Subquery returns more than 1 row
							作者:
							
								hbhe0316
					
					mysql> select count(*) from t1 where t1.id = (select t2.id from t2);
ERROR 1242 (21000): Subquery returns more than 1 row
 
解决方案,当然,两者的含义也不一样,需要自行判断。
mysql> select count(*) from t1 where t1.id = any(select t2.id from t2);
+----------+
| count(*) |
+----------+
|   959368 |
+----------+
1 row in set (2.12 sec)
mysql> select count(*) from t1 where t1.id = (select t2.id from t2 limit 1);
+----------+
| count(*) |
+----------+
|        2 |
+----------+
1 row in set (0.01 sec)
						
							版权声明:本文为博主原创文章,未经博主允许不得转载。
MYSQL
- 上一篇:Mysql子查询
 - 下一篇:Oracle与Mysql时间对比
 

					
				
			

