select Vendor, ID, count(*) from ImportTable group by Vendor, ID having
count(*) > 1;

-----Original Message-----
From: Jeff Gannaway [mailto:[EMAIL PROTECTED] 
Sent: Saturday, July 10, 2004 5:11 PM
To: [EMAIL PROTECTED]
Subject: Is there an easy way to find duplicate records in a table?

I have a table that our distributor sent us.  The table doesn't have any 
keys.  It does, however, have 7,782 duplicate records.  I found this out 
when I tried to have MySQL make a unique product ID by combining 2 fields 
of each record.

Here's what I need to know...

Is there a MySQL command that will reveal duplicate entries in a table, and 
find them by looking at just 2 fields???  I'm trying to create a primary 
key in the new table by combining 2 fields together (Vendor and ID).

Sample data format:

+======================+
| ImportTable          |
+======================+
| Vendor | ID  | Price |
+--------+-----+-------+
| AAD    | 1   | $9.98 |
| AAD    | 1   | $3.98 |
| AAD    | 52  | $9.98 |
| BCD    | 2   | $8.98 |
| BCD    | 5   | $8.98 |
| CSX    | 44  | $7.98 |
+--------+-----+-------+

I'd like something that will identify 'AAD 1' as a duplicate, even though 
their Prices are different.

Thanks!!
-Jeff Gannaway
_______________________________________________

http://RadioU.com
This Is Where Music Is Going - Listen Online!
_______________________________________________



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to