Oninit Logo
The Down System Specialists
Partnerships Contact

-4432 An element in a GROUP clause must be a member of the ORDER BY clause.

In order to perform grouping, the set of selected rows must be ordered on the same columns. This is the only way to force all the equal values to be found together, as a group. Rewrite the statement so that each selected value that you want to group also appears in an ORDER BY clause. Note that both these clauses allow you to refer to selected values by their position number, as in the following example:

SELECT customer_num, month(order_date), avg(ship_weight) FROM orders ORDER BY 1, 2 GROUP BY 1,2