标签: mysql duplicates
我们有两个表
工资
salarytwo
我需要根据employeename从两个表中找到重复的记录数。如果雇员姓名在多行中相同,则在我的情况下将被视为重复。
输出应如下所示
答案 0 :(得分:0)
尝试
SELECT t.employeename, count(*) FROM ( SELECT s1.employeename FROM salary s1 UNION ALL SELECT s2.employeename FROM salarytwo s2 ) t GROUP BY t.employeename HAVING count(*) > 1