Mysql:This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' 错误解决

在Mysql中使用嵌套查询,就是在子查询中的select语句带有limit。

比如这样的语句是不能正确查询的:

select * from tableA where id in(select id from tableB limit 0,1);

不然会报错误:This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

解决方法是在后面的子查询中再嵌套一层(把子查询当成一张表再查):

select * from tableA where id in(select t.id from (select id from tableB limit 0,1) as t );

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章