这是我目前的代码:
SELECT e.AUDIT_ID,s.USER_ID,s.AUD_ID
FROM USERS_123 e,USERS s WHERE e.USER_ID = s.USER_ID
结果:
e.AUDIT_ID | s.USER_ID,| s.AUD_ID
2222389 abcdef0192 2222389
2222400 abcdef0203 2222400
2222399 abcdef0202 2222399
2222398 abcdef0201 2222398
2222397 abcdef0200 2222397
我想知道的是:
在上面的结果的Col e.AUDIT_ID中的Dupe值(如果有的话)
显示出这种类型的重复的东西:
2222389 abcdef019 2222389
2222389 abcdef019 2222389
2222389 abcdef019 2222389
2222388 abcdef0191 22222388
2222387 abcdef0190 22222387
答案 0 :(得分:1)
更新:
SELECT e.AUDIT_ID, s.USER_ID, s.AUD_ID
FROM USERS_123 e, USERS s
WHERE e.USER_ID = s.USER_ID
GROUP BY e.AUDIT_ID, s.USER_ID, s.AUD_ID
HAVING COUNT(*) > 1
获取任何存在的重复AUDIT_ID
(旧响应):
SELECT audit_id
FROM users_123
GROUP BY audit_id
HAVING COUNT(*) > 1;
答案 1 :(得分:0)
重复AUDIT_ID
?好吧,根据该ID和计数分组:
SELECT audit_id
FROM users_123
HAVING COUNT(*) > 1;