方法:使用Row_number() over (partition by col1 order by col2)
该方法先根据col1分组,然后根据col2排序,最后每组均从1开始编号
sql语句
select * from
(select id,Row_number() over (partition by id order by id) rn from table1) t
where rn=1
Oracle获取某字段不重复的记录
本文导语: 方法:使用Row_number() over (partition by col1 order by col2)该方法先根据col1分组,然后根据col2排序,最后每组均从1开始编号 sql语句select * from (select id,Row_number() over (partition by id order by id) rn from table1) t where rn=1
方法:使用Row_number() over (partition by col1 order by col2)
该方法先根据col1分组,然后根据col2排序,最后每组均从1开始编号
sql语句
select * from
(select id,Row_number() over (partition by id order by id) rn from table1) t
where rn=1