I have a table where I am trying to build a distinct list of all the cities with more than two occurrences in the table. I am trying the current query am am told "function count does not exist"? What am I doing wrong?
SELECT COUNT (city)
FROM `table1`
GROUP BY city
HAVING COUNT (city) >=2
Your query is correct you have given a space between COUNT and (City) it must be COUNT(City). that will work fine. Your query should be like this:
SELECT City, COUNT(city) Counts
FROM `table1`
GROUP BY City
HAVING COUNT(city) >=2;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With