Join the table to itself. For example, given the following table:CREATE TABLE dbo.Table1( ID integer NOT NULL IDENTITY(1,1) PRIMARY KEY CLUSTERED, ColumnA varchar(50) NOT NULL, ColumnB varchar(50) NOT NULL) ON [PRIMARY]GO
Your query would be:SELECT ID = a.ID, DuplicateID = b.IDFROM Table1 AS a INNER JOIN Table1 AS b ON a.ColumnA = b.ColumnA And a.ColumnB = b.ColumnB
to find duplicates for the values of ColumnA and ColumnB. If you don't want the same matches repeated multiple times, then you have to make other changes to the query. You can find out more by searching this site for "finding duplicates".