1、一个表中单个列重复的值
SELECT id, firstName, lastName, email, COUNT(*) FROM contacts GROUP BY firstName HAVING COUNT(firstName) > 1;
结果是:其中count(*)是表示重复的次数。
2、在多个列中查找重复值
SELECT id, firstName, lastName, email, COUNT(*) FROM contacts GROUP BY firstName, lastName, email HAVING COUNT(firstName) > 1 AND COUNT(lastName) > 1 AND COUNT(email) > 1;
结果:
__________________________________________________________________________________