Friday, February 19, 2016

Check duplicates for combination of multiple columns

If you have combination of multiple columns that you want to check duplicates. 

For example : Check duplicates for combination of

 AGE,NAME,SEX,DOB,CITY

Sql will be :

select AGE,NAME,SEX,DOB,CITY,count(1) 
from Employees 
group by AGE,NAME,SEX,DOB,CITY 
having count(1) >1;

No comments :

Post a Comment