listagg 函数将组内的数据通过 order by 排序后,再连接到一起,可以指定分隔符。输入多行,输出一行或多行。常用来将值连接成逗号分隔的数据。
语法:
三个使用场景:
-
As a single-set aggregate function,
LISTAGGoperates on all rows and returns a single output row. -
As a group-set aggregate, the function operates on and returns an output row for each group defined by the
GROUPBYclause. -
As an analytic function,
LISTAGGpartitions the query result set into groups based on one or more expression in thequery_partition_clause.
场景2,根据 group by 子句的分组情况,每组返回一行;
场景3,作为分析函数,根据
LISTAGG函数详解

最低0.47元/天 解锁文章
467

被折叠的 条评论
为什么被折叠?



