报错说不是单组分组函数?是什么情况呢?

SELECT d.RECEIPT_NUM,       c.PAT_NAME, --病人姓名       b.PAT_MEDCARDNO, --医疗证号       b.DIAGNOSIS_DATE, --就诊时间       c.WORKUNIT_NAME, --单位名称       sum(a.SUM_TOTAL) mzfy, --门诊费用       sum(a.SUM_RECEIVABLE) tczf --统筹支付  FROM op.OP_CHGNOTE            a,       op.OP_MEDILIST_LOG       b,       op.OP_VISIT              c,       OP.OP_CHGNOTE_PAY_MASTER d WHERE (a.VISIT_ID = b.VISIT_ID)   and (b.VISIT_ID = c.VISIT_ID)   and d.CHGNOTE_ID = a.CHGNOTE_ID   and a.REFUND_ORIGIN is null   and a.REFUND_REVERSE is null   and a.SUSER_ID = b.OPERATOR_ID   and b.ACCOUNT_SIGN = '2'

九州编程
浏览 442回答 2
2回答

慕田峪9158850

SELECT d.RECEIPT_NUM, c.PAT_NAME, --病人姓名 b.PAT_MEDCARDNO, --医疗证号 b.DIAGNOSIS_DATE, --就诊时间 c.WORKUNIT_NAME, --单位名称 sum(a.SUM_TOTAL) mzfy, --门诊费用 sum(a.SUM_RECEIVABLE) tczf --统筹支付 FROM op.OP_CHGNOTE a, op.OP_MEDILIST_LOG b, op.OP_VISIT c, OP.OP_CHGNOTE_PAY_MASTER d WHERE (a.VISIT_ID = b.VISIT_ID) and (b.VISIT_ID = c.VISIT_ID) and d.CHGNOTE_ID = a.CHGNOTE_ID and a.REFUND_ORIGIN is null and a.REFUND_REVERSE is null and a.SUSER_ID = b.OPERATOR_ID and b.ACCOUNT_SIGN = '2'group by c.PAT_NAME,b.PAT_MEDCARDNO, b.DIAGNOSIS_DATE, c.WORKUNIT_NAME

鸿蒙传说

聚合函数 要么单独使用 要么加group by
打开App,查看更多内容
随时随地看视频慕课网APP