select * from (select *,row_number() over(partition by 用途 order by 产品用途表ID row_num) from 产品用途表) a where row_num=1 这是sql server的写法。oracle需要把row_number修改成dense_rank
热心网友时间:2023-10-23 16:44
产品用途表 字段 id name foruse
select id,name,foruse from 产品用途表 a where not exists (select 1 from 产品用途表 b where a.name = b.name and a.foruse = b.foruse and a.id < b.id)