Home » Topic » How to remove duplicate rows?

How to remove duplicate rows?

Lincoln Burrows ~ Modified: November 17th, 2015 ~ ~ 1 Minute Reading

Home Forums How to remove duplicate rows?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #890 Score: 0
    Andrew Jackson
    Moderator
    1 pt

    This will delete duplicate rows

    DELETE LU 
    FROM   (SELECT *, 
                   Row_number() 
                     OVER ( 
                       partition BY col1, col1, col3 
                       ORDER BY rowid DESC) [Row] 
            FROM   mytable) LU 
    WHERE  [row] > 1 
    
    #905 Score: 0
    Stephen West
    Moderator
    4 pts

    1. SELECT the DISTINCT records into a New Table
    2. TRUNCATE the Old Table
    3. MERGE the New Table back into the Old Table

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.