Home > Software design >  MySQL error: HAVING is not valid at this position, expecting EOF, ';'
MySQL error: HAVING is not valid at this position, expecting EOF, ';'

Time:12-30

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.

CodePudding user response:

SELECT city, SUM(credit_limit) AS total_limit FROM table GROUP BY city ORDER BY total_limit WHERE SUM(credit_limit) < 110000;

  • Related