Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting Duplicate Data (kind of ) 1

Status
Not open for further replies.

jestrada101

Technical User
Mar 28, 2003
332

TABLE_A
-------
FieldA - Primary Key
FieldB
FieldC
FieldD
FieldE - A Summary Field
FieldF - A summary Field

In this data, aside from FieldA, there is duplicates. FieldA is unique, but columns FieldB, FieldC and FieldD are identical. How can I determine which FieldA's match? The summaries in both are different.

Hope that makes sense.

Jose E

 
If I understand you correctly, you need to a list of FieldAs for rows that contain duplicate FieldB, FieldC, and FieldD values. If so, then try
Code:
SELECT FieldA, FieldB, FieldC, FieldD
  FROM my_table
 WHERE (FieldB, FieldC, FieldD) IN 
          (SELECT FieldB, FieldC, FieldD
             FROM my_table
            GROUP BY FieldB, FieldC, FieldD
            HAVING count(*) > 1)
          )
ORDER BY 2,3,4,1;
Doubtless there will be better solutions following soon, but this should at least get you started.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top