Duplicate records in mysql

Below is the query which can be used to find the duplicate records in a mysql table. Also can be used to retrieve the count of records matching certail condition.

select FIELD1,count(*) count FROM TABLE1 t1
join TABLE2 t2 on t2.ID=t1.EID where t1.EID in (200,300)
and t2.relation in ('FATHER','MOTHER','SISTER')
group by FIELD1
having count(*) > 0;


No comments:

Post a Comment