Posts
1150
Comments
891
Trackbacks
1
SQL: Removing Duplicate Rows Using a CTE

From here, for future reference:

WITH cte AS (
  SELECT[foo], [bar], 
     row_number() OVER(PARTITION BY foo, bar ORDER BY baz) AS [rn]
  FROM TABLE
)
DELETE cte WHERE [rn] > 1
posted on Wednesday, April 01, 2015 10:43 AM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Please add 2 and 5 and type the answer here: