Oracle pivot rows to columns(Oracle 将行转为列)
问题描述
我有以下表格:
我正在努力:
有可能吗?我一直在寻找示例,但仍然没有弄清楚.
Is it possible? I have been looking examples but still I don't get nothing clear.
谢谢!
推荐答案
一种选择是使用 PIVOT
Clause
One option would be using PIVOT
Clause
但这是静态的,例如.需要更新 tipo
列的不同值.为了使其动态化,您可以创建一个函数
but this is static, eg. needs to be updated as different values for tipo
column is added. In order to make it dynamic, you can create a function
然后使用调用
来自 SQL 开发人员的控制台.
from SQL developer's console.
演示
这篇关于Oracle 将行转为列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!