Q:使用limit报错,如select * from table where id in (select id from table limit 12),会报This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’
A:这样的语句是不能正确执行的。
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子查询的问题。
摘自:http://blog.sina.com.cn/s/blog_70e85d6c0100tq26.html
另外:
MySql查询前10条数据sql语句为:select * from table_name limit 0,10 。
通常0是可以省略的,直接写成 limit 10。0代表从第0条记录后面开始,也就是从第一条开始。