The following statement will find and display all duplicate rows in a table, except the row with the maximum rowid:
SELECT *
FROM <tableA> a
WHERE rowid <> (SELECT max(rowid)
FROM <tableB> b
WHERE a.<column1> = b.<column1>
AND a.<column2> = b.<column2> -- make sure all columns are compared
AND a.<column3> = b.<column3>;
Note: Duplicate rows which contain only NULL values will not be identified by above statement.
No comments:
Post a Comment