Invalid aggregate function reference Explanation: You cannot include in the WHERE clause (or in any subqueries of the WHERE clause) aggregate functions that use columns of tables in the FROM clause as their argument. User Action: Change your select expression to eliminate aggregate functions with this type of argument.