17,090
社区成员
发帖
与我相关
我的任务
分享
with t as
(select 1 id, 1 value
from dual
union all
select 1 id, 2 value
from dual
union all
select 2 id, 1 value
from dual
union all
select 2 id, 3 value
from dual
union all
select 2 id, 2 value from dual)
select t1.id, t1.value
from (select t.*,
row_number() over(partition by id order by value desc) rn
from t) t1
where t1.rn = 1;