Syntax error in HAVING clause.

Your SQL statement has an invalid HAVING clause. A reserved word may be misspelled or missing, or the punctuation may be incorrect.