在 SAP 中使用临时列计算一列的总和
你需要再次对你的查询进行选择。示例如下
SELECT DATE, FUND_ID, PPT_ID, SOURCE_ID, AMOUNT, SUM (AMOUNT) as TOTAL FROM ( SELECT AD.CHV_DATE.DATE, AD.CHV_FUND.FUND_ID, AD.CHV_PARTICT.PPT_ID, AD.CHV_PARTICT.SOURCE_ID, SUM (AD.CHV_PARTICT.AMOUNT), FROM AD.CHV_DATE, AD.CHV_FUND, AD.CHV_PARTICT, AD.CHV_SOURCE WHERE DC.CHV_SOURCE.FUND_ID=AD.CHV_FUND.FUND_ID AND (DC.CHV_SOURCE.DATE=AD.CHV_DATE.DATE) AND (DC.CHV_PARTICT.PPT_ID=AD.CHV_SOURCE.PPT_ID) AND ( AD.CHV_DATE.DATE IN ('2017-08-02') AND AD.CHV_PARTICT.PPT_ID IN ('PPT0449') ) GROUP BY AD.CHV_DATE.DATE, AD.CHV_FUND.FUND_ID, AD.CHV_PARTICT.PPT_ID, AD.CHV_SOURCE.SOURCE_ID) GROUP by DATE, FUND_ID, PPT_ID, SOURCE_ID, AMOUNT
广告