group_concat
description
Syntax
VARCHAR GROUP_CONCAT(VARCHAR str[, VARCHAR sep])
This function is an aggregation function similar to sum (), and group_concat links multiple rows of results in the result set to a string. The second parameter, sep, is a connection symbol between strings, which can be omitted. This function usually needs to be used with group by statements.
example
mysql> select value from test;
+-------+
| value |
+-------+
| a |
| b |
| c |
+-------+
mysql> select GROUP_CONCAT(value) from test;
+-----------------------+
| GROUP_CONCAT(`value`) |
+-----------------------+
| a, b, c |
+-----------------------+
mysql> select GROUP_CONCAT(value, " ") from test;
+----------------------------+
| GROUP_CONCAT(`value`, ' ') |
+----------------------------+
| a b c |
+----------------------------+
mysql> select GROUP_CONCAT(value, NULL) from test;
+----------------------------+
| GROUP_CONCAT(`value`, NULL)|
+----------------------------+
| NULL |
+----------------------------+
keyword
GROUP_CONCAT,GROUP,CONCAT