我正在使用此查询在表格中返回重复的电子邮件地址:
SELECT DISTINCT * FROM `customers`
WHERE email IN ( SELECT email FROM `customers` GROUP BY email HAVING COUNT(id) > 1)
示例输出:
TonyLoden - tloden@outlook.com
TonyLoden - tloden@outlook.com
MikeH3llgarth - mike.hallgarth@gmail.com
MikeH3llgarth - mike.hallgarth@gmail.com
如何修改查询以仅为每个找到的重复返回一个结果?
意思,相反,我希望它返回:
TonyLoden - tloden@outlook.com
MikeH3llgarth - mike.hallgarth@gmail.com