Unix Technical Forum

how to retrieve only the duplicates in a table

This is a discussion on how to retrieve only the duplicates in a table within the SQL Server forums, part of the Microsoft SQL Server category; --> There is a table with a single column with 75 rows - 50 unique / 25 duplicates. How would ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 06:43 PM
TimG
 
Posts: n/a
Default 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,

Tim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 06:43 PM
David Portas
 
Posts: n/a
Default Re: how to retrieve only the duplicates in a table

SELECT 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



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:34 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com