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
 General SQL Server Forums
 New to SQL Server Programming
 max count

Author  Topic 

uhertz
Starting Member

2 Posts

Posted - 2011-08-29 : 05:48:52
Have a customer and phone table.
Linked by a key, custid
Each customer has one or more phone numbers
Want to get a list of all custoemrs having >3 numbers

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-08-29 : 07:01:48
select c.customer_name from customer as c inner join phone as p
on c.key=p.key and c.custid=p.custid
group by c.customer_name
having count(*)>3

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -