Delete duplicate row based on one column, but need to retain rest of the values in tmp file

  • Thank you so very much. For some reason when I moved everything from the #temp table over to a @temp table and applied your logic....

    ;WITH cte as

    (

    SELECT *,

    ROW_NUMBER() OVER(PARTITION by co_num ORDER BY name) AS dupCnt

    FROM @tmp_FullfillOrder2

    )

    --Now Delete Duplicate Records

    DELETE FROM cte

    WHERE dupCnt > 1

    select * from @tmp_FullfillOrder2

    Dupicates were removed, but all of the rest of my calculations, etc., were intact. I can't thank you enough for all of your help and all of the great people who help us here at SqlServerCentral. You all are SUPER. Thank you again.

    Gillian

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply