- 写出一条Sql语句:取出表A中第31到第40记录(SQLServer,以自动增长的ID作为主键,注意:ID可能不是连续的
a. select top 10 * from A where id not in (select top 30 id from A)
演变步骤:
1)select top 30 id from T_FilterWords–取前条
2)select * from T_FilterWords where id not in (select top 30 id from T_FilterWords)–取id不等于前三十条
3)select top 10 * from T_FilterWords
b. select top 10 * from A where id > (select max(id) from (select top 30 id from A )as A)
c. 1用ROW_NUMBER实现
写出一条Sql语句:取出表A中第31到第40记录(SQLServer,以自动增长的ID作为主键,注意:ID可能不是连续的
SQL查询技巧:获取数据集的特定范围

被折叠的 条评论
为什么被折叠?



