Link to home
Start Free TrialLog in
Avatar of hojohappy
hojohappy

asked on

SQL Server Select Query to Find Duplicates within a file

Need a SQL Select query that will find duplicates within the same file on multiple columns.  Table is called Products.  
Two columns; Product_Code and Product_Source.    Need to find all records that have multiple occurances of Product_Code + Product_Source.

For example;

Product_Code       Product_Source
12345                    A
12345                    A                       ---> Duplicate
18888                    A
18888                    C                       ---> Not a duplicate record
44000                    D
99999                    C
99999                    C                     ---> Duplicate
ASKER CERTIFIED SOLUTION
Avatar of Luis Pérez
Luis Pérez
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Select Product_Code,ProductSource
from Products
Group By Product_Code,ProductSource
Having Count(*) > 1