name query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query with 50 peoples names in, some names appear more than once.
What I want to do it to show all names that appear more than once and not
show any name that appears once.

thanks
 
SELECT DISTINCT PeopleNames FROM [The Table] as T
WHERE (select count(*) from [THE TABLE] as T1
where T1.PeopleNames = T.PeopleNames) > 1
ORDER BY PeopleNames;

You need the DISTINCT to get the name only once. Otherwise, all of the rows
for each of the names that appear more than once in the table will be
presented.

Good Luck!
 
Back
Top