首页 > 代码库 > 解决"Subquery returns more than 1 row"sql查询错误

解决"Subquery returns more than 1 row"sql查询错误

http://blog.csdn.net/c517984604/article/details/7052186 [Err] 1242 - Subquery returns more than 1 row   --表示子查询返回了多行数据

例如:

select * from table1 where table1.colums=(select columns from table2)

解决方法

1,select * from table1 where column=any(select columns  from table2)

2,select * from table1 where column in(select columns  from table2);

3,select * from table1 a where exists 
(select columns from tableb2 b
where b.column=a.column
);
 

解决"Subquery returns more than 1 row"sql查询错误