sql - Finding duplicate members in a table -
i have come across problem in writing query find duplicate members in table. have tried simplify problem sample table , data.
create table mytable ( s_id varchar2(10), param varchar2(10), value varchar2(10) ); insert mytable (s_id, param, value) values ('1', 'name', 'a'); insert mytable (s_id, param, value) values ('1', 'age', '15'); insert mytable (s_id, param, value) values ('1', 'sex', 'm'); insert mytable (s_id, param, value) values ('2', 'name', 'b'); insert mytable (s_id, param, value) values ('2', 'age', '16'); insert mytable (s_id, param, value) values ('2', 'sex', 'm'); insert mytable (s_id, param, value) values ('3', 'name', 'a'); insert mytable (s_id, param, value) values ('3', 'age', '15'); insert mytable (s_id, param, value) values ('3', 'sex', 'm');
here items s_id 1 , 3 same.
here's easy way find duplicate values in 1 field:
select fieldname tablename group fieldname having count(*) > 1
Comments
Post a Comment