Discussion Locked

Number of Records in a query

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a contact db and need to query by city and show the total number of records found

2 replies

by timthetoolman

Hi,

SELECT COUNT(column) FROM table

Is what you want. You can add a where clause if you need to.

Cheers,
Tim.

by shanghai sam

Only a slight addition to Tims answer. If you need to display an individual city you can use the example Tim gave:

SELECT Count(PersonName) AS PersonCount, City
FROM ContactTable WHERE City = 'CityName'

If you need to return all of the citieswith their respective counts you can use:

SELECT Count(PersonName) AS PersonCount, City
FROM ContactTable
GROUP BY City

This discussion is closed to new replies.