如何求被另一组分组的每个组的总和?

发布于 01-14 16:03 字数 642 浏览 4 评论 0原文

我实际上正在尝试使用 Oracle Analytics 工具和 PL/SQL 制作矩阵表。

假设我有一个查询,其中包含 select 语句变量 Employee、Description、orderid、amount,并按 Employee、Description 进行分组。 Orderid 和 amount 属于同一组。从这个查询中,我想提取所有员工的每个描述的金额总和。你知道我该怎么做吗?

谢谢。

编辑: 假设我们有以下查询:

Select Employee, Description, orderid ,amount
  From Employees
 Group by Employee,Description

我想从每个描述组中提取金额总和,但从所有员工中提取金额总和。执行此操作的方法可能如下所示:

Select Description,sum(amount)
  From Employees
 Group by Description

但实际查询要复杂得多,如果我选择创建另一个查询为了查找每个描述的总和,我必须以某种方式将其链接到第一个查询,以便能够在报告中显示结果。 您是否知道通过 Oracle Analytics Publisher 实现此目的的方法?

谢谢。

I am actually trying to make a matrix table using Oracle Analytics tool and PL/SQL.

Let's say i have a query which has in select statement variables Employee, Description, orderid ,amount and is grouped by Employee, Description. Orderid and amount belong to the same group. From this query i want extract the sum of the amount of each description from all employees. Do you have any idea how i can do this?

Thank you.

Edit:
Let's say we have the following query:

Select Employee, Description, orderid ,amount
  From Employees
 Group by Employee,Description

I want to extract the sum of amount from each Description group but from all Employees.A way to do this could be like this:

Select Description,sum(amount)
  From Employees
 Group by Description

But the actual query is much more complex and if i choose to make another query for finding the sum of each description i have to link it somehow to the first query to be able to show the results at the report.
Do you have any idea of a way to do this through oracle analytics publisher?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

定格我的天空2025-01-21 16:03:42
Select coalesce(Employee,'ALL_EMPOYEES'), coalesce(Description,'ALL_DESCRIPTION'), orderid ,amount
  From Employees
 Group by ROLLUP (Employee,Description)


Select coalesce(Employee,'ALL_EMPOYEES'), coalesce(Description,'ALL_DESCRIPTION'), orderid ,amount
  From Employees
 Group by CUBE (Employee,Description)
Select coalesce(Employee,'ALL_EMPOYEES'), coalesce(Description,'ALL_DESCRIPTION'), orderid ,amount
  From Employees
 Group by ROLLUP (Employee,Description)


Select coalesce(Employee,'ALL_EMPOYEES'), coalesce(Description,'ALL_DESCRIPTION'), orderid ,amount
  From Employees
 Group by CUBE (Employee,Description)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文