解决mysql子查询里面无法使用LIMIT This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

这样写运行会报错This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
SELECT * FROM score se WHERE se.sid in
(
SELECT * FROM score sea
WHERE sea.course_id=1
LIMIT 0,2
)

那我们现在改成这样 用from来接查询结果集
SELECT * FROM score se WHERE se.sid in
(
SELECT seb.sid FROM 
(SELECT * FROM score sea
WHERE sea.course_id=1
LIMIT 0,2)
 as seb 
)

你可能感兴趣的:(mysql)