Row_number() over只是用于把查询的数据,为他增加一列连续的ID数
如:select *,Row_number() over(order by endtime desc) as IDRank from tb_12530_ring
那么,为表“tb_12530_ring” 增加一列IDRank连续数
select * from (select *,Row_number() over(order by endtime desc) as IDRank from tb_12530_ring
where id>10000 and id<20000 ) as IDWithRowNumber where IDRank>=1and IDRank<=10
红色字:endtime 是排序,where id>10000 and id<20000 用于条件查询
蓝色字:IDRank>=1and IDRank<=10 是选择1~10的行数
(因为IDRank列是由Row_number() over生成的连续id数)|