By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table t (id int, n int,v int);
insert into t(id,n,v)
select
1,3,1 from dual
union all
select 1, 3 , 10 from dual
union all
select 1 , 3 , 100 from dual
union all
select 1 , 3 , 201 from dual
union all
select 1 , 3 , 300 from dual
union all
select 2 , 1 , 13 from dual
union all
select 2 , 1 , 21 from dual
;
7 rows affected
select * from
(
select t.*, row_number() over(partition by id ,n order by v desc) as rn
from t
) t1
where t1.rn=t1.n
ID | N | V | RN |
---|---|---|---|
1 | 3 | 100 | 3 |
2 | 1 | 21 | 1 |