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
Microsoft SQL Server

Avatar of undefined
Last Comment
Guy Hengel [angelIII / a3]

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Luis Pérez

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dukster131

Select Product_Code,ProductSource
from Products
Group By Product_Code,ProductSource
Having Count(*) > 1
Guy Hengel [angelIII / a3]

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy