Oracle SQL函数listagg实现多行字符串连接

listagg 函数将组内的数据通过 order by 排序后,再连接到一起,可以指定分隔符。输入多行,输出一行或多行。常用来将值连接成逗号分隔的数据。


语法:


三个使用场景:

  • As a single-set aggregate function, LISTAGG operates 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 theGROUPBY clause.

  • As an analytic function, LISTAGG partitions the query result set into groups based on one or more expression in thequery_partition_clause.

场景1,作用在所有行上面,返回一行;

场景2,根据 grou

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值