Home >Database >Mysql Tutorial >MSSQL查询第五条到第十条数据_MySQL

MSSQL查询第五条到第十条数据_MySQL

WBOY
WBOYOriginal
2016-06-01 13:16:261903browse

查询数据库中第五条数据到第十条数据,分两种情况:

1,ID是连接的,当然这种情况比较好查。直接SELECT就可以了,取ID大于5小于10就可以了,

这种情况比较少。

2,ID不是连接的,如果要取第五条数据到第十条数据,就得从SQL查询SELECT着手

select top 10 * from TB1 where Id not in (select top 5 Id from TB1 )
其中10表示:查询的数量,5表示是从第几条开始查。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn