如何过滤此处的最大值
select *
from (
select *
, row_number() over (partition by name order by ox asc) as rn
from YourTable
) as SubQueryAlias
where rn = 1
在文件rn = 1
之上
我想过滤rn = max(rn)
答案 0 :(得分:2)
将order by ox asc
更改为order by ox desc
并使用rn = 1
select *
from (
select *
, row_number() over (partition by name order by ox desc) as rn
from YourTable
) as SubQueryAlias
where rn = 1
答案 1 :(得分:0)
选中此项以获得rn = max(rn):
select top 1 * from
( select * ,
row_number() over (partition by name order by ox asc)
as rn from YourTable )
as SubQueryAlias
order by rn desc