Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Arshad.

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

Answered by: Connor McDonald - Last updated: October 14, 2020 - 4:08 am UTC

Category: SQL - Version: 12C

Viewed 100+ times

You Asked

Hello,

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

Tnx.

and we 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


More to Explore

Analytics

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