当前位置:网站首页>oracle 多行数据合并成一行数据
oracle 多行数据合并成一行数据
2022-07-05 09:29:00 【相思子~】
前言
划水的时候看到有人问了这个问题,顺手写个sql记录一下。
原sql数据(多行)
select null as v1_name, 1 as v1, '名称2' as v2_name, 2 as v2
from dual
union all
select '名称3' as v1_name, 3 as v1, '名称4' as v2_name, 4 as v2
from dual

合并后
select (wm_concat(a.v1_name)) as v1_name,
(wm_concat(a.v1)) as v1,
(wm_concat(a.v2_name)) as v2_name,
(wm_concat(a.v2)) as v2
from (select null as v1_name, 1 as v1, '名称2' as v2_name, 2 as v2
from dual
union all
select '名称3' as v1_name, 3 as v1, '名称4' as v2_name, 4 as v2
from dual) a

边栏推荐
猜你喜欢

LeetCode 496. Next larger element I
![[reading notes] Figure comparative learning gnn+cl](/img/44/2e13d63ef654663852cbccb342b838.png)
[reading notes] Figure comparative learning gnn+cl

Three-level distribution is becoming more and more popular. How should businesses choose the appropriate three-level distribution system?

C语言-从键盘输入数组二维数组a,将a中3×5矩阵中第3列的元素左移到第0列,第3列以后的每列元素行依次左移,原来左边的各列依次绕到右边

Wxss template syntax

【组队 PK 赛】本周任务已开启 | 答题挑战,夯实商品详情知识

揭秘百度智能测试在测试自动执行领域实践

如何正确的评测视频画质

基于模板配置的数据可视化平台

Svgo v3.9.0+
随机推荐
7 月 2 日邀你来TD Hero 线上发布会
Dry goods sorting! How about the development trend of ERP in the manufacturing industry? It's enough to read this article
Deep understanding of C language pointer
顶会论文看图对比学习(GNN+CL)研究趋势
【js 根据对象数组中的属性进行排序】
[ManageEngine] how to make good use of the report function of OpManager
一次 Keepalived 高可用的事故,让我重学了一遍它
TDengine 连接器上线 Google Data Studio 应用商店
【阅读笔记】图对比学习 GNN+CL
[how to disable El table]
LeetCode 496. Next larger element I
Unity SKFramework框架(二十四)、Avatar Controller 第三人称控制
云计算技术热点
LeetCode 503. Next bigger Element II
Talking about the difference between unittest and pytest
使用el-upload封装得组件怎么清空已上传附件
[sourcetree configure SSH and use]
[JS sort according to the attributes in the object array]
How to empty uploaded attachments with components encapsulated by El upload
Shutter uses overlay to realize global pop-up