我希望从mysql返回重复的ID 这是我的查询
> 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 :(得分:2)
将id
更改为GROUP_CONCAT(id)
:
SELECT COUNT(title) AS duplicate_Count , title , GROUP_CONCAT(id)
FROM lyric
GROUP BY title
HAVING COUNT(title) > 1