Advice Using Pivot Table in Oracle(在 Oracle 中使用数据透视表的建议)
问题描述
我需要一个报告,我应该使用数据透视表.报告将按类别分组.语句时使用 case 不好,因为类别很多.您可以将 Northwind 数据库视为示例,所有类别将是显示为列和报告将显示客户在类别中的偏好.我不知道其他解决方案,并在 Internet 中看到了 SQL Server 存储过程的示例.除了用例之外,您知道解决方案吗?
i need a report and i should use pivot table for it.Report will be group by categories .It is not good to use case when statement because there are many categories.u can think Northwind Database as sample and All Categories will be shown as Columns and Report will show customers preference among Categories.I dont know another solution and saw examples as Stored Procedures in Internet for Sql Server.Do u know a Solution except for using case when?
谢谢
推荐答案
一旦您获得 Oracle 11G,就会有一个 内置 PIVOT 功能.在此之前,您只能使用 CASE(或 DECODE)表达式.我在我的博客上有一篇关于如何自动执行此操作的文章.
Once you get Oracle 11G there is a built-in PIVOT feature. Prior to that, you are restricted to using CASE (or DECODE) expressions. I have an article on how to automate doing that on my blog.
这篇关于在 Oracle 中使用数据透视表的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Oracle 中使用数据透视表的建议
基础教程推荐
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 无法解决整理冲突 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
