现在的位置: 首页 > 综合 > 正文

MySql语句问题-in 与 limit

2017年12月01日 ⁄ 综合 ⁄ 共 261字 ⁄ 字号 评论关闭

常用分页查询语句问题: 

 select top 3 from users where userId not in ( select top 3 userId from users);

 这是在分页中常用的select查询语句

 由于mysql不支持top,以及limit语法限制,移植后如下

 select * from users where userId not in ( select t.userId from ( select * from users order by userId limit 3) as t) limit 3;

 实现取出 抛去前三条记录的三个记录。

感谢adolinzi文章的帮助

抱歉!评论已关闭.