Im having that problem in this specific line:
SELECT city, SUM(credit_limit) AS total_limit
FROM table
GROUP BY city
ORDER BY total_limit
HAVING SUM(credit_limit) < 110000;
Probably is a stupid error, but im not seeing a syntax problem here.