【发布时间】:2011-04-15 10:50:25
【问题描述】:
你好, 我有一个连接表,表示 tableA 和 tableB。 tableA 有一个名为 Amount 的列。 tableB 有一个名为 refID 的列。当 refID 具有相同的值时,我想合计 Amount 列。我在查询中使用了 SUM,但它给我一个错误:
ORA-30483: window functions are not allowed here
30483. 00000 - "window functions are not allowed here"
*Cause: Window functions are allowed only in the SELECT list of a query.
And, window function cannot be an argument to another window or group
function.
这是我的查询供您参考:
select *
from (
select SUM(A.Amount), B.refId, Rank() over (partition by B.refID order by B.id desc) as ranking
from table A
left outer join table B on A.refID = B.refID
)
where ranking=1;
我可以知道是否有任何替代解决方案可以让我对金额求和?
谢谢@!
【问题讨论】: