Orders the data in a group before applying the GROUP FILTER clause and aggregating the data.
GROUP ORDER BY column [ASC[ENDING]|DESC[ENDING]] [, ...]
column |
Any column in the source streams or windows. You can order by more than one column. |
The GROUP ORDER BY clause is used with the GROUP BY clause. Rows may be ordered by one or more columns in the stream or window. GROUP ORDER BY orders the data in a group before applying aggregation operations (and before applying GROUP FILTER).
Use ASC and DESC keywords to organize column data in ascending or descending order. If no keyword is specified, the default is ascending order.
When used with a GROUP FILTER clause, GROUP ORDER BY is performed before GROUP FILTER. The GROUP ORDER BY clause orders records in each group based on the ordering criteria specified in the clause.
The GROUP ORDER BY clause organizes the chosen rows by T.Volume in descending order:
CREATE WINDOW Window1 SCHEMA (Symbol STRING, MaxPrice INTEGER) PRIMARY KEY DEDUCED KEEP ALL AS SELECT T.Symbol, max(T.Price) MaxPrice FROM Trades T GROUP FILTER rank() < 10 GROUP BY T.Symbol GROUP ORDER BY T.Volume DESC HAVING max(T.Price) > 100 AND T.Symbol ='IBM';