龙哥网

龙哥网

SQL从第几条数据起调用的select查询语句(sql查询指定的第几条数据)
2021-12-17

SQL SERVER数据库,使用sql语句查询数据表中第几条起的数据,或查询数据表中第n条到第m条之间的数据。

示例:

PS:content是要查询的数据表,id是content数据表中的主键字段。

1、查询数据表中第3条起的数据

select * from content where id not in (select top 3 id from content order by id desc) order by id desc

2、查询数据表中第4条至第10条数据

select top 7 * from content where id not in (select top 3 id from content order by id desc) order by id desc
免责声明
本站部分资源来源于互联网 如有侵权 请联系站长删除
龙哥网是优质的互联网科技创业资源_行业项目分享_网络知识引流变现方法的平台为广大网友提供学习互联网相关知识_内容变现的方法。