{"id":10,"date":"2009-03-22T19:26:59","date_gmt":"2009-03-22T19:26:59","guid":{"rendered":"https:\/\/adeelejaz.com\/blog\/?p=10"},"modified":"2016-01-10T03:12:14","modified_gmt":"2016-01-10T03:12:14","slug":"select-duplicate-rows-from-a-table","status":"publish","type":"post","link":"https:\/\/adeelejaz.com\/blog\/select-duplicate-rows-from-a-table\/","title":{"rendered":"Select duplicate rows from a table"},"content":{"rendered":"<p>Every now and then you might want to see rows which are duplicate (or appear more than once in a table). For example, in a table of ZIP codes, you will not want the ZIP codes to be repeated and the query below will help you in finding any duplicates:<\/p>\n<pre>SELECT DISTINCT column_name\r\nFROM table_name\r\nGROUP BY column name\r\nHAVING COUNT(column_name) &gt; 1<\/pre>\n<p>Brilliant or what \ud83d\ude09<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content --><p class=\"wp-flattr-button\"><a href=\"https:\/\/adeelejaz.com\/blog\/?flattrss_redirect&amp;id=10&amp;md5=67ab1537e682661534c5afb5d815cd47\" title=\"Flattr\" target=\"_blank\"><img src=\"https:\/\/adeelejaz.com\/blog\/wp-content\/plugins\/flattr\/img\/flattr-badge-white.png\" srcset=\"https:\/\/adeelejaz.com\/blog\/wp-content\/plugins\/flattr\/img\/flattr-badge-white.png, https:\/\/adeelejaz.com\/blog\/wp-content\/plugins\/flattr\/img\/flattr-badge-white@2x.png 2xhttps:\/\/adeelejaz.com\/blog\/wp-content\/plugins\/flattr\/img\/flattr-badge-white.png, https:\/\/adeelejaz.com\/blog\/wp-content\/plugins\/flattr\/img\/flattr-badge-white@3x.png 3x\" alt=\"Flattr this!\"\/><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Every now and then you might want to see rows which are duplicate (or appear more than once in a table). For example, in a table of ZIP codes, you will not want the ZIP codes to be repeated and the query below will help you in finding any duplicates: SELECT DISTINCT column_name FROM table_name [&hellip;]<!-- AddThis Advanced Settings generic via filter on wp_trim_excerpt --><!-- AddThis Share Buttons generic via filter on wp_trim_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":1,"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":11,"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/posts\/10\/revisions\/11"}],"wp:attachment":[{"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adeelejaz.com\/blog\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}