Column <str> cannot be referred to in the select list, ORDER BY, or HAVING clause because it is not in the GROUP BY clause Explanation: In the select list and HAVING clauses of select expressions containing the GROUP BY clause, you can refer only to those columns named in the GROUP BY clause. User Action: Either add the column named in the message to the GROUP BY clause, or delete from the select list or HAVING clause.