[Oracle] 数据排重
--查找重复数据
SELECT NODE_ID, BUSI_ID
FROM I_AGENT_BUSI_AMOUNT
WHERE STAT_TIME = 200601
GROUP BY NODE_ID, BUSI_ID
HAVING COUNT(*) > 1
--排重
SELECT *
FROM I_AGENT_BUSI_AMOUNT
WHERE ROWID IN (SELECT RID
FROM (SELECT ROWID RID,
ROW_NUMBER() OVER(PARTITION BY NODE_ID, BUSI_ID ORDER BY ROWID) RN
FROM I_AGENT_BUSI_AMOUNT
WHERE STAT_TIME = 200601)
WHERE RN 1)
SELECT NODE_ID, BUSI_ID
FROM I_AGENT_BUSI_AMOUNT
WHERE STAT_TIME = 200601
GROUP BY NODE_ID, BUSI_ID
HAVING COUNT(*) > 1
--排重
SELECT *
FROM I_AGENT_BUSI_AMOUNT
WHERE ROWID IN (SELECT RID
FROM (SELECT ROWID RID,
ROW_NUMBER() OVER(PARTITION BY NODE_ID, BUSI_ID ORDER BY ROWID) RN
FROM I_AGENT_BUSI_AMOUNT
WHERE STAT_TIME = 200601)
WHERE RN 1)