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 2005 Forums
 Transact-SQL (2005)
 count county....[:)]

Author  Topic 

srk
Starting Member

4 Posts

Posted - 2008-12-23 : 00:43:33
urgency..pls help solve it....
i have a table with fields company,county...
there are lot of counties and many companies registered to these companies.i wanna take the count of companies corresponding to each county.Should look like
County[b/] [b]Number
------------- --------------
Carlow 1727
Cavan 2169
Clare 3882
Cork 18852 etc..............

srk

Jai Krishna
Constraint Violating Yak Guru

333 Posts

Posted - 2008-12-23 : 00:49:25
SELECT County AS 'County[b/]',Count(DISTINCT Company) AS '[b]Number' FROM yourtable GROUP By County ORDER BY County

Jai Krishna
Go to Top of Page

srk
Starting Member

4 Posts

Posted - 2008-12-23 : 00:51:47
sorry stupid question. thnx.
i was very much screwed up with this work that i forgot the basic things....
thanks mate

srk
Go to Top of Page

Jai Krishna
Constraint Violating Yak Guru

333 Posts

Posted - 2008-12-23 : 00:52:33
Welcome

Jai Krishna
Go to Top of Page
   

- Advertisement -