DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Imp SQL required

  1. #1
    Join Date
    Nov 1999
    Posts
    226
    Hi

    I have a table which has 580 rows and these are having duplicate rows . I want to get the distinct rows out of these . what SQL do I write to delete the half ie. 240 lines .

    regards

  2. #2
    Join Date
    Feb 2000
    Location
    Singapore
    Posts
    1,758

    Wink SQL to delete duplicate rows.


    DELETE FROM TAB1 A
    WHERE ROWID > (SELECT MIN(ROWID) FROM TAB1 B
    WHERE A.COL1=B.COL1
    AND A.COL2=B.COL2
    AND A.COL3=B.COL3
    ........)


    Here TAB1 is the name of table and COL1, COL2, COL3.... are the names of the columns that make primary key for the table.

    Sanjay

Posting Permissions

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


Click Here to Expand Forum to Full Width