【发布时间】:2018-10-19 20:13:58
【问题描述】:
我正在尝试计算 ID 为 118 的外科医生在 2016 年赚取的金额
通过使用代码:
select (sum(count(*) * professional_fee)) AS
"Total amount earned by 118"
from operation, operation_type, staff
where operation.actual_op = operation_type.op_code
and staff.person_id = operation.surgeon
and surgeon = 118
and extract(YEAR from op_date) = 2016
group by professional_fee;
我可以得到9600的正确结果
但是当我添加时
select (sum(count(*) * professional_fee) **+ annual_basic_salary**) AS
"Total amount earned by 118"
from operation, operation_type, staff
where operation.actual_op = operation_type.op_code
and staff.person_id = operation.surgeon
and surgeon = 118
and extract(YEAR from op_date) = 2016
group by professional_fee, **annual_basic_salary**;
我得到错误:ORA-00937: not a single-group group function
这里是使用的表格:
【问题讨论】: