Find duplicate values in an Oracle table

0

Have a table in an Oracle database called MESSAGE. This table has some fields among them LOCALID and APPLICATIONNAME.

Following examples of values entered in the base

LOCALID - APPLICATIONNAME
1       - app1
1       - app1
1       - app1
2       - app2
2       - app2
2       - app2
1       - app3
1       - app3

Sometimes LOCALID is being repeated for different APPLICATIONNAME.

I need to find all of these values that have different APPLICATIONNAME and LOCALID alike.

How to do an Oracle query for such a scenario?

    
asked by anonymous 15.08.2017 / 19:52

1 answer

1

I did not quite understand which of these two you would need, so I included both:

A query to find duplicates:

Select localid, applicationname, count(*)
from mensagem
group by localid, applicationname
having count(*) > 1;

A query to find all the different combinations or the two fields.

select distinct localid, applicationname 
from mensagem
    
15.08.2017 / 20:26