duminică, 27 martie 2016

Oracle SQL how to find/identify duplicates in a table/result set

If you need to identify duplicates in a table (or a result set) just run the following query:

select <column>,
          count(<column>)
from <table>
group by <column>
having count(<column>) > 1
order by 2 desc;

<column> = the name of the column you know it should be unique
<table> = the result set in which you want to search (could be a table or another select)

Niciun comentariu:

Trimiteți un comentariu