您的位置:首页 > 数据库 > Oracle

oracle distinct多字段去重

2016-02-19 10:56 597 查看
--select * from ti_vw_boss结果:

transactionid   dn                     dn_type productid                     src_spid                opt_type   opt_time      state
100000000000011213 158550570010PIBPXXT100118510 0 18-2月 -16 0
100000000000011244 158550570010PIBPXXT100118510 0 18-2月 -16 0


现在要对表数据去重,留下一行,修改如下:

select * from ti_vw_boss where transactionid in (select min(TRANSACTIONID) from ti_vw_boss group by dn,dn_type,productid,src_spid);

结果:

transactionid   dn                     dn_type productid                     src_spid                opt_type   opt_time      state
100000000000011213 158550570010PIBPXXT100118510 0 18-2月 -16 0


满足要求!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: