select T.BILL_CODE,t.SCAN_TYPE,t.PIECE,SCAN_SITE,SCAN_MAN,
row_number() over(partition by t.bill_code order by t.scan_date desc) AS R
from tab_scan_send t
语法:
rank() over (order by 排序字段 顺序)
rank() over (partition by 分组字段 order by 排序字段 顺序)
--已知:两种排名方式(分区和不分区):使用和不使用partition
--两种计算方式(连续,不连续),对应函数:dense_rank,rank,
row_number()
rank() over (order by 排序字段 顺序)
rank() over (partition by 分组字段 order by 排序字段 顺序)
--已知:两种排名方式(分区和不分区):使用和不使用partition
--两种计算方式(连续,不连续),对应函数:dense_rank,rank,
row_number()