This query will show you a list of all Vendor, ID combinations, and how
many times they appear if they appear more than once in your data:

SELECT Vendor, ID, Count(1) as dupes
FROM name_of_your_table_goes_here
GROUP BY Vendor, ID
HAVING Count(1) >1

Yours,
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


                                                                                       
                                
                      Jeff Gannaway                                                    
                                
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]            
                             
                      hics.com>                cc:                                     
                                
                                               Fax to:                                 
                                
                      07/10/2004 05:10         Subject:  Is there an easy way to find 
duplicate records in a table?    
                      PM                                                               
                                
                                                                                       
                                
                                                                                       
                                




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