{"id":424,"date":"2019-05-30T10:19:46","date_gmt":"2019-05-30T14:19:46","guid":{"rendered":"http:\/\/techref.camellarry.com\/?p=424"},"modified":"2019-05-30T10:20:40","modified_gmt":"2019-05-30T14:20:40","slug":"sql-delete-duplicate-rows-based-on-column","status":"publish","type":"post","link":"http:\/\/techref.camellarry.com\/?p=424","title":{"rendered":"SQL Delete duplicate rows based on column"},"content":{"rendered":"<p>To remove duplicate rows, use a CTE and partition using the data you want to check for duplicates to assign a row_number against. Then remove any where the row_number &gt; 1 (removing multiple duplicates)<\/p>\n<blockquote><p>WITH CTE AS<br \/>\n(SELECT ROW_NUMBER() OVER<br \/>\n(PARTITION BY computername ORDER BY ( SELECT 0)) RN<br \/>\nFROM temp_devicerefresh)<br \/>\nDELETE FROM CTE WHERE RN &gt; 1<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>To remove duplicate rows, use a CTE and partition using the data you want to check for duplicates to assign a row_number against. Then remove any where the row_number &gt; 1 (removing multiple duplicates) WITH CTE AS (SELECT ROW_NUMBER() OVER (PARTITION BY computername ORDER BY ( SELECT 0)) RN FROM temp_devicerefresh) DELETE FROM CTE WHERE [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[29,45,70,72],"class_list":["post-424","post","type-post","status-publish","format-standard","hentry","category-sql","tag-example","tag-microsoft","tag-sql","tag-syntax"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9t3oE-6Q","_links":{"self":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=424"}],"version-history":[{"count":2,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/424\/revisions"}],"predecessor-version":[{"id":427,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=\/wp\/v2\/posts\/424\/revisions\/427"}],"wp:attachment":[{"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=424"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/techref.camellarry.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}