Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Arshad.

Asked: October 13, 2020 - 11:01 pm UTC

Last updated: October 14, 2020 - 4:08 am UTC

Version: 12C

Viewed 1000+ times

You Asked

Hello,

Need to understand as to how do we find duplicate records using JOIN conditions

Tnx.

and Connor said...

You look for matching keys that a different rows, for example

select *
from emp e1, emp e2
where e1.empno = e2.empno
and e1.rowid != e2.rowid

but generally you're better off using an analytic function eg

select *
from 
 ( select e.*, count(*) over ( partition by empno )  as c
  from emp e
)
where c > 1



Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Analytics

Analytic SQL got you confused? Check out Connor McDonald's complete video course.