Oracle查询重复数据
发布时间:2020-12-12 14:10:37 所属栏目:百科 来源:网络整理
导读:–查询重复数据 select tt.* from 表 tt where 自定义条件 and tt.重复字段 in ( select t.重复字段 from 表 t where 自定义条件 group by t.重复字段 having count (t.重复字段) 1 ) –查询重复数据中id最小的那个 select tt.* from 表 tt where 自定义条件
–查询重复数据 select tt.* from 表 tt where 自定义条件 and tt.重复字段 in (select t.重复字段 from 表 t where 自定义条件 group by t.重复字段 having count(t.重复字段) > 1)
–查询重复数据中id最小的那个 select tt.* from 表 tt where 自定义条件 and tt.重复字段 in (select t.重复字段 from 表 t where 自定义条件 group by t.重复字段 having count(t.重复字段) > 1) and tt.id in (select min(t.id) from 表 t where 自定义条件 group by t.重复字段 having count(t.重复字段) > 1) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |