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
 Select

Author  Topic 

BendJoe
Posting Yak Master

128 Posts

Posted - 2008-05-07 : 15:03:12
I need to list all the states which has more than 10 cities .
Table is

CityID, City , State.

What is the query to do this.
Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-07 : 15:05:49
Can we see what you tried till now?
Go to Top of Page

BendJoe
Posting Yak Master

128 Posts

Posted - 2008-05-07 : 16:05:35
Select State, Count(City) from Table
Group by State

This gives two columns state and count of city in the state but I dont know how to filter it with a where clause.
Go to Top of Page

BendJoe
Posting Yak Master

128 Posts

Posted - 2008-05-07 : 16:35:17
Select State From Table Group By State Having Count(City)>10
Will this work?
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-05-07 : 17:07:45
yep
Go to Top of Page
   

- Advertisement -