Sunday, April 28, 2013

how to find duplicates in two columns of mysql database table

any one column can have duplicates. but both columns together are unique. this is how you find duplicates

select   columnA,
         columnB,
         count(*)
from     table_name
group by columnA,
         columnB
having   count(*) > 1