2016-04-21 108 views
1

,我想回去IDS從MySQL 重複,這是我的查詢如何從ID爲mysql數據庫重複條目重複

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

和結果是這樣的:

 
duplicate_Count title id 
2  text  121 
3  text_2 233 

但我想這樣的結果:

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

任何幫助,請

+0

的[MySQL的組某些結果到一個數組]可能的複製(http://stackoverflow.com/questions/14060332/mysql-group-certain-結果到數組) – swajak

回答

2

變化idGROUP_CONCAT(id)

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

Example

+0

感謝工作正常 –