[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)
posted @ 2006-02-21 17:50  vanuan  阅读(405)  评论(0编辑  收藏  举报