|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
My title must be confusing but I don't know how to put it.
I have one column with county and another with client name. i'm trying to query how many clients are in one county. Client County df surrey sd surrey ds Hampshire gh London dj London kl Hampshire can anyone please help me out with this. thanks in advance. Regards Arsalan |
|
#2
|
|||
|
|||
|
Quote:
Hi, Just see whether this works, till the gurus come in Code:
select county,count(client) as nos from your_table_name group by county Thanks |
|
#3
|
|||
|
|||
|
hi
thanks for your reply. i manage to get the the statement work but because both those column are in different table so i'm inner join to show it, but i think the INNER join is not working .. SELECT Description, COUNT(Company) AS NO.OFCLIENTS FROM locations, clients GROUP BY Description INNER JOIN locations ON clients.LocationId=locations.LocationId the table Locations contains column ( Description, LocationID) and Clients contains column ( Company, LocationID) many thanks regards, Arsalan Quote:
|
|
#4
|
||||
|
||||
|
Try this
Code:
SELECT L.Description, COUNT(C.Company) AS NO.OFCLIENTS FROM clients as C GROUP BY L.Description INNER JOIN locations as L ON C.LocationId=L.LocationId |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > SQL Server 2005 - How to calculate one row field against another row |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|