{"id":5,"date":"2010-06-02T23:43:18","date_gmt":"2010-06-02T21:43:18","guid":{"rendered":"http:\/\/unckel.com\/blog\/?p=5"},"modified":"2019-12-07T22:06:14","modified_gmt":"2019-12-07T21:06:14","slug":"sql-duplikate-mit-anzahl-ausgeben","status":"publish","type":"post","link":"https:\/\/unckel.de\/blog\/sql-duplikate-mit-anzahl-ausgeben\/","title":{"rendered":"SQL: Duplikate mit Anzahl ausgeben"},"content":{"rendered":"<p>Ausgabe aller Duplikate (einer Spalte) und deren Anzahl per SQL ermitteln.<\/p>\n<pre>SELECT Spalte, (COUNT(*)-1) AS Anzahl\nFROM Tabelle\nGROUP BY Spalte\nHAVING COUNT(*)&gt;1\nORDER BY COUNT(*) DESC;<\/pre>\n<table class=\"contentDataTable\">\n<thead>\n<tr>\n<th>Spalte<\/th>\n<th>Anzahl<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>A. M\u00fcller<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>B. Schneider<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>W. Weber<\/td>\n<td>1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Ausgabe aller Duplikate (einer Spalte) und deren Anzahl per SQL ermitteln. SELECT Spalte, (COUNT(*)-1) AS Anzahl FROM Tabelle GROUP BY Spalte HAVING COUNT(*)&gt;1 ORDER BY COUNT(*) DESC; Spalte Anzahl A. M\u00fcller 5 B. Schneider 2 W. Weber 1<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71],"tags":[],"class_list":["post-5","post","type-post","status-publish","format-standard","hentry","category-webdesign"],"_links":{"self":[{"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/posts\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":1,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":789,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/posts\/5\/revisions\/789"}],"wp:attachment":[{"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}