2016-04-21 3 views
1

i ids Duplikat erhalten von mysql das istwie doppelten Eintrag aus der Datenbank MySQL mit der ID duplizieren

>  SELECT COUNT(title) AS duplicate_Count , title , id 
>  FROM lyric 
>  GROUP BY title 
>  HAVING COUNT(title) > 1 

und Ergebnis ist meine Abfrage will zurück:

 
duplicate_Count title id 
2  text  121 
3  text_2 233 

Aber ich mag dieses Ergebnis:

 
duplicate_Count title id 
2  text  121 , 122 
3  text_2 233 ,260 ,56 

jede mögliche Hilfe bitte

+0

Mögliches Duplikat [MySQL Gruppe bestimmter Ergebnisse in ein Array] (http://stackoverflow.com/questions/14060332/mysql-group-certain- results-in-a-array) – swajak

Antwort

2

ändern id-GROUP_CONCAT(id):

SELECT COUNT(title) AS duplicate_Count , title , GROUP_CONCAT(id) 
FROM lyric 
GROUP BY title 
HAVING COUNT(title) > 1 

Example

+0

danke funktioniert gut –

Verwandte Themen