-
-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
Description
Currently, GroupConcat() only accepts "asc", "desc" and None for ordering parameter.
But GROUP_CONCAT supports more complex features in ORDER BY.
As an example, multiple columns and expressions:
GROUP_CONCAT(column1 ORDER BY column2, NATURAL_SORT_KEY(column3) SEPARATOR ', ') AS mycolumnIn the example above, the ordering can be done using "other" columns (column2 and column3) similar to a standard "ORDER BY". (We use the raw SQL above since GroupConcat() don't support this at the moment)
As shown in the MySQL docs:
GROUP_CONCAT([DISTINCT] expr [,expr ...]
[ORDER BY {unsigned_integer | col_name | expr}
[ASC | DESC] [,col_name ...]]
[SEPARATOR str_val])
and MariaDB docs even added LIMIT support:
GROUP_CONCAT([DISTINCT] expr [,expr ...]
[ORDER BY {unsigned_integer | col_name | expr}
[ASC | DESC] [,col_name ...]]
[SEPARATOR str_val]
[LIMIT {[offset,] row_count | row_count OFFSET offset}])
Metadata
Metadata
Assignees
Labels
No labels