I have a database table with 3 columns, I want to find all duplicates that are uncomplicated and clean .
The table is almost structured
ID column A column B AABB1 AAA CCC 2 AAA BBB3 x BBB
Then my Do the queries make columns 0 and 2 a joint duplicate entry as both column A and column B?
Standard SQL Preferences, but running on SQL 2008 Server
Groups and duplicate rows that can create queries:
SELECT COUNT (1), column A, column B to yourtable group of column A, column B HAVING COUNT (1) & gt; 1
You can then add it to a subfree to output the full rows that contain duplicate data.
Based on your sample data, here is a complete executable Example:
Make Table # Your Feature ([ID] INT, [Column A] VARCHAR (3), [Column B] VARCHAR (3)); INSERT #YourTable ([ID], [ColumnA], [ColumnB] Price (0, 'AA', 'BBB'), (1, 'AA', 'CCC'), (2, 'AA', 'BBB '), (3,' xxx ',' bbb '); Select * from # to your T1, where available (SELECT COUNT (1), ColumnA, ColumnB FROM #YourTable WHERE t1.ColumnA = ColumnA and t1.ColumnB = column B group column A, column B HAVING COUNT (1) & gt; ; 1) Drop Table # YourTable
No comments:
Post a Comment