1. 程式人生 > >子查詢中不能使用limit或者in

子查詢中不能使用limit或者in

acc count account doesn 查詢 sub query ron any

select * from wechat_account_info where id in(select id from wechat_account_info where groupId =‘8‘ ORDER BY id limit 15 ) as s

此句執行中會出現如下錯誤:

[Err] 1235 - This version of MySQL doesn‘t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery‘

原因:

MYSQL子查詢不支持limit

解決辦法:

再次使用一層循環

select * from wechat_account_info where id in(
select id from (select id from wechat_account_info where groupId =‘8‘ ORDER BY id limit 15 ) as s )

子查詢中不能使用limit或者in