我在下面做错了什么?
select D_OPERATION_DATE, count(*)
from
(select to_char(D_OPERATION_DATE, 'MON') D_OPERATION_DATE, SUM (N_OPERATION_FEE) from SBM_BILLING_RESULT where c_operation_type='Commit' and C_RESULT_STATUS='SUCCESS')
group by D_OPERATION_DATE;
错误: ORA-00937:不是单组组功能 00937. 00000 - “不是单组小组的功能” *原因:
*行动: 行错误:13列:17
任何线索?
答案 0 :(得分:1)
您在内部语句中使用'sum()'与单个列名'to_char(D_OPERATION_DATE,'MON')'。 在这种情况下,你需要'GROUP BY to_char(D_OPERATION_DATE,'MON')'到内部语句的结尾。
select D_OPERATION_DATE, count(*)
from (
select to_char(D_OPERATION_DATE, 'MON') D_OPERATION_DATE, SUM (N_OPERATION_FEE)
from SBM_BILLING_RESULT
where c_operation_type='Commit' and C_RESULT_STATUS='SUCCESS'
GROUP BY to_char(D_OPERATION_DATE, 'MON')
)
group by D_OPERATION_DATE;