当前位置:网站首页>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
边栏推荐
- TDengine ×英特尔边缘洞见软件包 加速传统行业的数字化转型
- An article takes you into the world of cookies, sessions, and tokens
- [JS sort according to the attributes in the object array]
- Svgo v3.9.0+
- Develop and implement movie recommendation applet based on wechat cloud
- Cloud computing technology hotspot
- 高性能Spark_transformation性能
- OpenGL - Coordinate Systems
- Why does everyone want to do e-commerce? How much do you know about the advantages of online shopping malls?
- The research trend of map based comparative learning (gnn+cl) in the top paper
猜你喜欢
LeetCode 31. Next spread
Go 语言使用 MySQL 的常见故障分析和应对方法
项目实战 | Excel导出功能
Newton iterative method (solving nonlinear equations)
c语言指针深入理解
Unity SKFramework框架(二十四)、Avatar Controller 第三人称控制
一文读懂TDengine的窗口查询功能
Unity skframework framework (XXIII), minimap small map tool
AUTOSAR from getting started to mastering 100 lectures (103) -dbc file format and creation details
LeetCode 556. Next bigger element III
随机推荐
Composition of applet code
[JS sort according to the attributes in the object array]
MySQL does not take effect in sorting string types
观测云与 TDengine 达成深度合作,优化企业上云体验
揭秘百度智能测试在测试自动执行领域实践
Svgo v3.9.0+
Tutorial on building a framework for middle office business system
[team PK competition] the task of this week has been opened | question answering challenge to consolidate the knowledge of commodity details
TDengine可通过数据同步工具 DataX读写
Figure neural network + comparative learning, where to go next?
Principle and performance analysis of lepton lossless compression
[ManageEngine] how to make good use of the report function of OpManager
百度交易中台之钱包系统架构浅析
【对象数组a与对象数组b取出id不同元素赋值给新的数组】
【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用
测试老鸟浅谈unittest和pytest的区别
VS Code问题:长行的长度可通过 “editor.maxTokenizationLineLength“ 进行配置
Node collaboration and publishing
How to improve the operation efficiency of intra city distribution
[two objects merged into one object]