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 );

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