For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!
Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.
24QRQ2.fvu.log (19.44 KB)
This is one way of finding out (arbitrarily) duplicate rows:
select * from (select key , a , b , row_number() over (partition by a, b order by null ) rn from t ) where rn > 1 /
It assigns a ranking based on groups of "a, b" combinations and shows you the ones where it ranks higher than one. If you want to see all the duplicates, you could use this:
select key , a , b from t where (a, b) in (select a, b from t group by a, b having Count(*) > 1 )
There are probably lots of other (and better) ways to do this.
DELETE yourtable WHERE ROWID IN ( SELECT LEAD(ROWID) OVER (PARTITION BY key1, key2 ORDER BY NULL) FROM yourtable );
Try this one:
SELECT Max(Key) FROM t GROUP BY A, B HAVING COUNT(*) > 1
Message was edited by: Michel SALAIS Now if you want to delete you can do the following
DELETE t WHERE ROWID NOT IN (SELECT SELECT Max(ROWID) FROM t GROUP BY A, B)