说明:返回结果集分区内行的序列号,每个分区的第一行从 1 开始。
用例:ROW_NUMBER() OVER(ORDER BY CreateTime DESC)
select * from (select ROW_NUMBER() Over(order by createtime desc) as rowId,t.* from Table1 t where t.id>10) as t where rowId between 3 and 5
上面的sql语句返回 Table1表 中 id 大于 10 的所有记录按创建时间倒序的第 3 到第 5 条记录
用例:ROW_NUMBER() OVER(ORDER BY CreateTime DESC)
select * from (select ROW_NUMBER() Over(order by createtime desc) as rowId,t.* from Table1 t where t.id>10) as t where rowId between 3 and 5
上面的sql语句返回 Table1表 中 id 大于 10 的所有记录按创建时间倒序的第 3 到第 5 条记录
其中 (select ROW_NUMBER() Over(order by createtime desc) as rowId,t.* from Table1 t where t.id>10) 为数据集Table1表 中 id 大于 10 的所有记录