snowflake.snowpark.Column.within_group¶
- Column.within_group(*cols: ColumnOrName | Iterable[ColumnOrName]) Column[source]¶
Returns a Column expression that adds a WITHIN GROUP clause to sort the rows by the specified columns.
This method is supported on Column expressions returned by some of the aggregate functions, including
functions.array_agg(),functions.listagg(), PERCENTILE_CONT(), and PERCENTILE_DISC(). For details, see the Snowflake documentation for the aggregate function that you are using (e.g. ARRAY_AGG).Examples: