标签:server 大于 from ble tab style not row div
SQL SERVER 查询第20行到30之间的数据
1.先查询前20行的ID,后查询除去20条记录的前10条记录
SELECT TOP 10 * FROM tbBank WHERE BankID NOT IN(SELECT TOP 20 BankID FROM tbBank ORDER BY BankID ASC)
2.先查询前20行记录最大的ID,后查询大于该值的前10条记录
SELECT TOP 10 * FROM tbBank WHERE BankID>(SELECT MAX(BankID) FROM (SELECT TOP 20 BankID FROM tbBank ORDER BY BankID ASC)AS TEMP)
3.SQL SERVER 2015 以后使用 ROW_NUMBER() 函数
SELECT * FROM (SELECT *,ROW_NUMBER() OVER(ORDER BY BankID ASC) AS Num FROM tbBank )AS TempTable WHERE Num BETWEEN 21 AND 30
标签:server 大于 from ble tab style not row div
原文地址:https://www.cnblogs.com/heyangyi/p/8778110.html