How to get the top 10 data and 10 data in SQL

xiaoxiao2021-04-05  263

1,

How to get before

10

Pen information

SELECT TOP 10 * FROM table name

2,

How to get the first

10

Pen

20

Data between pen

Select Top 10 * from (SELECT TOP 20 * from TableName Order By ID Desc) Order by ID

or

SELECT TOP 10 * from TB

WHERE ID NOT IN (SELECT TOP 10 * from Tb Order By ID)

ORDER BY ID

or

SELECT TOP 10 * from (SELECT TOP 20 * from Tb Order By ID) a ORDER BY ID DESC

or

SELECT TOP 10 * from Tb WHERE ID> (SELECT TOP 10 ID from TB) A) Order By ID

or

Select * from Table_1 LIMIT 11, 20;

转载请注明原文地址:https://www.9cbs.com/read-132126.html

New Post(0)