如何从数据库 mysql 中获取 ID 重复的重复条目
how to get duplicate entry from database mysql with id duplicate
我想从 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
请帮忙
将id
改为GROUP_CONCAT(id)
:
SELECT COUNT(title) AS duplicate_Count , title , GROUP_CONCAT(id)
FROM lyric
GROUP BY title
HAVING COUNT(title) > 1
我想从 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
请帮忙
将id
改为GROUP_CONCAT(id)
:
SELECT COUNT(title) AS duplicate_Count , title , GROUP_CONCAT(id)
FROM lyric
GROUP BY title
HAVING COUNT(title) > 1