Search code examples
sqloracle8

Finding duplicates from the same table having different ID using ORACLE SQL?


I would like to find the duplicate casecitation_entry values that have different OBJECT_ID in CASE_CITATION table. Could you please advise the oracle SQL?

enter image description here


Solution

  • This type of problem can be approached in multiple ways. EXISTS is a typical one:

    select t.*
    from t
    where exists (select 1
                  from t t2
                  where t2.CASE_CITATION = t.CASE_CITATION and t2.OBJECT_ID <> t.OBJECT_ID
                 );