Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Counting records
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Counting records
Miscellaneous
Thread ID:
00437817
Message ID:
00437817
Views:
45
I have two tables, co_location, and phone numbers. They are related by location_id.
The phone_numbers table has many phone numbers from each city.

I am trying to write a query that will bring up each city that has phone numbers in the phone_number table with something like:

SELECT DISTINCT Co_location.cl_city
FROM dbo.Co_Location Co_location, dbo.phone_numbers Phone_numbers
WHERE Phone_numbers.location_id = Co_location.location_id

What I also want is a count for each city of how many numbers there are for that city. so it would look like:

Billings 1000
Birmingham 500
Boston 398
Charlotte 768 *768 being the number of times Charlotte location_id appears in the phone_numbers table

is there any way this can be done?
Thanks,
Ryan
Next
Reply
Map
View

Click here to load this message in the networking platform