Delete replicated records

Results 1 to 2 of 2

Thread: Delete replicated records

  1. #1
    Join Date
    Dec 1969

    Default Delete replicated records

    Hi,<BR>I have a table where many records have been duplicated and triplicated... I need to remove the copies but retain one of the records...<BR>THe SQL statement below will delete all the copies including the original- I need to modify so that one record will remain...<BR><BR>I tried to use DISTINCT in the subquery but this will only remove one of the triplicated records--- I think... it never actually worked for me....<BR><BR>Cheers<BR><BR>DELETE FROM SAMPLE_DATA<BR>WHERE SAMPLE_DATA.SETCODE IN <BR> (SELECT SAMPLE_DATA.SETCODE<BR> FROM SAMPLE_DATA<BR> GROUP BY SAMPLE_DATA.SETCODE, SAMPLE_DATA.SAMN, SAMPLE_DATA.OIDENT, SAMPLE_DATA.DATREC, SAMPLE_DATA.P, SAMPLE_DATA.TON, SAMPLE_DATA.NH4N, SAMPLE_DATA.NO3_N, SAMPLE_DATA.NO2_N, SAMPLE_DATA.TDN, SAMPLE_DATA.TRP, SAMPLE_DATA.TDP, SAMPLE_DATA.TP<BR> HAVING ((Count(SAMPLE_DATA.SETCODE))&#062;1) <BR> );<BR>

  2. #2
    Join Date
    Dec 1969

    Default FAQ's

    If you check the answer is in there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts