What do you mean by "the primary key is different"?
Duplicates are defined with respect to some key definition. The standard way of identifying duplicates is:
SELECT ... FROM table t1
(SELECT 1 FROM table t2
WHERE t2.key_col1 = t1.key_col1
AND t2.key_colN = t1.key_colN
AND t2.rowid != t1.rowid)
t1.key_col1, ..., t1.key_colN
This assumes that the "key" columns aren't defined as a (primary or unique) key constraint in the database (but there should be defined an index on the columns if the table is large!)
If the "key" columns are defined as a key constraint (and you're getting duplicate errors when trying to INSERT), CREATE a temp table AS SELECT from the table in question (plus CREATE an index on the key columns), and perform the query above on the temp table.
Last Wiki Answer Submitted: May 24, 2004 8:09 am by ActorJack0 pts.