Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 help with sql

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-04-10 : 06:07:17
I have an sql
select * from users order by name

now how could I make an sql to count all of the entires -- like for example how many of the same names and if the same name is in the table more then 10 times to tell me the name and amount of times.
so if "tom" is in the table more than 10 times it will show me tom and amount of times and the same for all the names.

Can anyone help me with this?

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2005-04-10 : 07:24:54
[code]
select name,count(*)
from users
group by name
having count(*) > 10
order by name
[/code]
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-04-10 : 07:45:56
thanks! :)
Go to Top of Page
   

- Advertisement -