Re: Finding duplicate rows in a table
From: Teresa A Larson <larson_at_sled.gsfc.nasa.gov>
Date: 13 Jul 1994 13:45:35 GMT
Message-ID: <300r5v$r9b_at_paperboy.gsfc.nasa.gov>
Date: 13 Jul 1994 13:45:35 GMT
Message-ID: <300r5v$r9b_at_paperboy.gsfc.nasa.gov>
Try the following:
set pagesize 60;
spool filename.dups;
SELECT col1, col2, COUNT(*)
FROM tablename
GROUP BY col1, col2
HAVING COUNT(*) > 1;
set pagesize 24;
spool off;
Where col1, col2 ... coln are the column(s) comprising your primary key. This will generate a listing of the records that have duplicates (a count > 1).
Good luck, Teresa Larson +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+Received on Wed Jul 13 1994 - 15:45:35 CEST
| Teresa A. Larson - Hughes STX Corporation |
| NASA/GSFC Code 933.0 voice: (301) 286-7867 |
| Greenbelt, Maryland 20771 fax: (301) 286-1777 |
| Teresa.Larson_at_gsfc.nasa.gov |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+