如果sql語句中的子查詢包含limit
例如: select * from a where id in (select id from b limit 3)
會報錯:This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery' #
解決辦法:
1、加一層子查詢
例如:select * from a where id in (select t.id from (select id from b limit 3 )as t)
2、把限制條件放到from而非where子句中,就不必出現嵌套再嵌套。
例如:select * from (select id from a limit 3) as foo