Discussion Locked
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
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.
Trending Web Development posts
Sort by Trending
0 helpful
1 reply
1 helpful
3 replies
Discussion Locked
What Makes a Business Website Effective in 2026
2 helpful
10 replies
Question Unanswered
How do you protect downloadable files on a WordPress store?
0 helpful
0 replies
Question
Windows and macOS computers becoming slow or unstable after updates - what should I check first
0 helpful
1 reply