For example suppose I have
SELECT sum(...) as total
Can I do something like
WHERE total > 1开发者_JS百科0
When I try that actual syntax I get an error unknown column 'total' in 'where clause' using MySQL
Use HAVING
instead of WHERE
for conditions involving aggregates:
SELECT SUM(somecolumn) AS total FROM sometable HAVING total > 10;
Try HAVING
HAVING total > 10
精彩评论