-
我正在try 查找表中的所有行,其中的某一列在其中重复.并通过每行具有的唯一的
id
列来标识它们. -
我想删除它们,只保留一份(行),无论是哪一份都无所谓.(如果可以通过SQL完成,最好是这样,如果有说明,我会进行编码.)
(我正在使用工作台)
我试过这个:
SELECT
*
FROM
table_name
GROUP BY `field_name`
HAVING COUNT(*) > 1;
It failed.
My first problem was the sql_mode=only_full_group_by
, so I fixed it by adding field names to the query. and it worked.. well, sort of. Since now I saw only the aggregated result without the id
column.
SELECT
field_name
FROM
table_name
GROUP BY `field_name`
HAVING COUNT(*) > 1;
所以,我来了... 我该怎么做呢?