Как отфильтровать макс. РН здесь
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 = 1
Я хочу отфильтровать rn = max(rn)
rn = max(rn)
Измените order by ox asc на order by ox desc и используйте rn = 1
order by ox asc
order by ox desc
select * from ( select * , row_number() over (partition by name order by ox desc) as rn from YourTable ) as SubQueryAlias where rn = 1
Отметьте это, чтобы получить 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