SELECT
*
FROM
`user`
WHERE
( `user`.id ) IN ( SELECT article.user_id FROM article GROUP BY article.user_id ORDER BY COUNT( article.user_id ) DESC LIMIT 0, 3 )
即MySQL中in关键字不能和limit连用,即会报1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'的错误
要解决很简单,不让in关键字和limit关键字在一层上,把后面的子查询语句包起来,
SELECT
*
FROM
`user`
WHERE
( `user`.id ) IN (
SELECT
a.user_id
FROM
( SELECT article.user_id FROM article GROUP BY article.user_id ORDER BY COUNT( article.user_id ) DESC LIMIT 0, 3 ) AS a
)
注意 是把后面查出来的数据当做一个新表,来多包一层,让in和limit没在一层。