我正在尝试添加列中的所有值以获得该列的总数,有人知道这个技巧吗?
这是我的查询:
select T.*,
sum(nvl(BIN1,0))+sum(nvl(BIN2,0))+sum(nvl((BIN3,0)) as TOTAL
from
(
SELECT CSM_FLASKS.FLASK_CODE,
MN_ASSAYS_STAGES.ASSAY_STAGE_ID,
VITRO_REP.TREATMENT_DOSE(CSM_FLASKS.GROUP_ID) AS TREATMENT_DOSE,
MN_RI_REP.FLASK_BIN_VALUE_BY_INDEX(MN_ASSAYS_STAGES.ASSAY_STAGE_ID, CSM_FLASKS.FLASK_ID, 1) AS BIN1,
MN_RI_REP.FLASK_BIN_VALUE_BY_INDEX(MN_ASSAYS_STAGES.ASSAY_STAGE_ID, CSM_FLASKS.FLASK_ID, 2) AS BIN2,
MN_RI_REP.FLASK_BIN_VALUE_BY_INDEX(MN_ASSAYS_STAGES.ASSAY_STAGE_ID, CSM_FLASKS.FLASK_ID, 3) AS BIN3,
MN_RI_REP.CBPI_FLASK(MN_ASSAYS_STAGES.ASSAY_STAGE_ID, CSM_FLASKS.FLASK_ID, 1, 2, 2) AS CBPI,
CSM_EXPERIMENTS.EXPT_CODE
FROM CSM_TREATMENT_GROUPS_EXPTS
INNER JOIN CSM_ASSAYS
ON CSM_ASSAYS.EXPT_ID = CSM_TREATMENT_GROUPS_EXPTS.EXPERIMENT_ID
INNER JOIN CSM_FLASKS
ON CSM_TREATMENT_GROUPS_EXPTS.GROUP_ID = CSM_FLASKS.GROUP_ID
INNER JOIN MN_ASSAYS
ON CSM_ASSAYS.ASSAY_ID = MN_ASSAYS.ASSAY_ID
INNER JOIN MN_ASSAYS_STAGES
ON MN_ASSAYS.MN_ASSAY_ID = MN_ASSAYS_STAGES.MN_ASSAY_ID
INNER JOIN CSM_EXPERIMENTS
ON CSM_EXPERIMENTS.EXPT_ID = CSM_TREATMENT_GROUPS_EXPTS.EXPERIMENT_ID
AND CSM_EXPERIMENTS.EXPT_ID = CSM_ASSAYS.EXPT_ID
WHERE CSM_ASSAYS.ASSAY_ID = 1000060
AND MN_ASSAYS_STAGES.STAGE_ID = 2
ORDER BY CSM_TREATMENT_GROUPS_EXPTS.ORDER_INDEX,
CSM_FLASKS.FLASK_ID,
CSM_FLASKS.IS_PLUS DESC
) T
错误:ORA-00937:不是单组组函数 00937。00000 -“不是单组组函数” *原因:
*操作:行错误:1 列:9