常用分页查询语句问题:
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文章的帮助
本文介绍了一种在数据库分页查询中排除特定记录的方法,并提供了针对MySQL的实现方案。通过使用子查询和LIMIT关键字,可以有效地从数据集中移除前几条记录,从而实现灵活的数据分页。
816

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



