Wednesday, March 7, 2012

how to retrieve only the duplicates in a table

There is a table with a single column with 75 rows - 50 unique / 25
duplicates. How would pull back a list of the rows that have/are
duplicates?

This is a question that I got in an interview. I didn't get it,
obviously...

Thanks,

TimSELECT col1, col2, col3, ...
FROM Sometable
GROUP BY col1, col2, col3, ...
HAVING COUNT(*)>1

--
David Portas
----
Please reply only to the newsgroup
--

"TimG" <timgru@.hotmail.com> wrote in message
news:744d8a29.0311072031.75846c64@.posting.google.c om...
> There is a table with a single column with 75 rows - 50 unique / 25
> duplicates. How would pull back a list of the rows that have/are
> duplicates?
> This is a question that I got in an interview. I didn't get it,
> obviously...
> Thanks,
> Tim

No comments:

Post a Comment