MySQL5.1中子查询是不能使用LIMIT的,
会报错: “This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’ ”
比如这样的语句是不能正确执行的。
select * from table where id in (select t.id from (select * from table limit 12)as t)
这样就可以绕开limit子查询的问题。
会报错: “This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’ ”
比如这样的语句是不能正确执行的。
select * from table where id in (select id from table limit 12);
select * from table where id in (select t.id from (select * from table limit 12)as t)
这样就可以绕开limit子查询的问题。
本文介绍在MySQL5.1中如何解决LIMIT与子查询结合使用的限制问题,并提供了一个有效的解决方案。
1181

被折叠的 条评论
为什么被折叠?



