Column <str> named outside a aggregate function in a SELECT with HAVING but no GROUP BY Explanation: In select expressions with a HAVING clause but without a GROUP BY clause, you cannot directly name columns in the select list or HAVING clause. You can refer to them only as aggregate function arguments, or in a WHERE clause. User Action: Either make the column named in the message an aggregate function argument, or if it is in a HAVING clause, change the HAVING clause to a WHERE clause.