how to select all duplicates efficiently

Viewed 17972

I want to select all rows that have a value that already exists in the table. I did not find a better solution than

select * 
from provisioning_requests tt 
where code in (select code 
               from provisioning_requests tt2 
               where tt2.id <> tt.id)

This seems a bit naive. Does anybody have a better solution?

8 Answers
Related