You are here: This query must be easy but need help « MsSQL Server « IT news, forums, messages
This query must be easy but need help

Posted by gwhite1 on 01/19/06 07:12

I have a table like this:

Name, SSN
Joe Smith, 1111
Tom Why, 2222
Larry Sam, 3333
Paul Tom, 4444
Steve bob, 1111

I want a query to pull off

Joe Smith, 1111
Steve bob, 1111

because someone accidently put in two different names with the same
SSN. There should only be one 1111 in the SSN field in the whole
database. I want to pull the duplicate SSN with the name. How can one
query do this. I can write a VB program to do it but I think a query
should work.

I know how to do this:

SELECT SSN, COUNT(*) AS cnt
FROM test
GROUP BY fSSN
HAVING (COUNT(*) > 1)

to find the duplicate SSN but I need the name listed with the SSN also.
Any help?? Thanks!!

Sheila

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация