Files
doris/docs/zh-CN/sql-reference/sql-functions/string-functions/group_concat.md
ZhangYu0123 1d9b3aeee7 [Doc] Repair document format (#4336)
The error format '##keyword' in a lot of docs. This pr is to repair document format. #4335
2020-08-13 23:39:41 +08:00

1.7 KiB

title, language
title language
group_concat zh-CN

group_concat

description

Syntax

VARCHAR group_concat(VARCHAR str[, VARCHAR sep])

该函数是类似于 sum() 的聚合函数,group_concat 将结果集中的多行结果连接成一个字符串。第二个参数 sep 为字符串之间的连接符号,该参数可以省略。该函数通常需要和 group by 语句一起使用。

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                      |
+----------------------------+

keyword

GROUP_CONCAT,GROUP,CONCAT