{"id":1380,"date":"2012-05-11T16:05:00","date_gmt":"2012-05-11T16:05:00","guid":{"rendered":"http:\/\/galhano.com\/blog\/?p=1380"},"modified":"2012-05-11T16:05:00","modified_gmt":"2012-05-11T16:05:00","slug":"finding-duplicates-with-sql","status":"publish","type":"post","link":"http:\/\/galhano.com\/blog\/?p=1380","title":{"rendered":"Finding Duplicates with SQL"},"content":{"rendered":"<p>Here&#8217;s query for finding duplicates in a table. Suppose you want to find all Usernames values in a table that exist more than once:<\/p>\n<p>[sql]<\/p>\n<p>SELECT Username, COUNT(Username) AS NumOccurrences<br \/>\nFROM   Users<br \/>\nGROUP BY Username<br \/>\nHAVING      (COUNT(Username) &gt; 1)<\/p>\n<p>[\/sql]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s query for finding duplicates in a table. Suppose you want to find all Usernames values in a table that exist more than once: [sql] SELECT Username, COUNT(Username) AS NumOccurrences FROM Users GROUP BY Username HAVING (COUNT(Username) &gt; 1) [\/sql]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"close","ping_status":"close","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[179,79],"class_list":["post-1380","post","type-post","status-publish","format-standard","hentry","category-sql","tag-sql","tag-sqlserver","author-admin"],"_links":{"self":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1380"}],"version-history":[{"count":1,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1380\/revisions"}],"predecessor-version":[{"id":1381,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1380\/revisions\/1381"}],"wp:attachment":[{"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1380"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/galhano.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}