写出一条Sql语句:取出表Customer中第31到第40记录(SQLServer,以自动增长的Id作为主键,注意:Id可能不是连续的。

select top 10 * from (select ROW_NUMBER() over(order by Id) as rows,* from Customer) as C where C.rows>30 order by Id

select top 10 * from Customer where id not in(select top 30 Id from Customer order by Id)order by Id

select top 10 * from Customer where id>(select MAX(Id) from (select top 30 Id from CUstomer order by Id) as Customer) order by Id

原文地址:https://www.cnblogs.com/zhubangchao/p/8513844.html