CR中多个表的汇总计算

时间:2016-02-03 16:50:41

标签: crystal-reports group-summaries

我正在研究水晶报告,对摘要问题有一定的影响 - 我有一批数据有三个级别的摘要:

"ordinv_rec"."activity"
"ordinv_rec"."op_region_2"
"ordinv_rec"."operator"

这是我的疑问:

SELECT "ordinv_rec"."activity", "ordinv_rec"."status_2", "ordinv_rec"."operator_2", "ordinv_rec"."quote_no", "ordinv_rec"."vehicle_class_2", "customer"."veh_capex_2016", "ordinv_rec"."date_created", "ordinv_rec"."capex_value", "ordinv_rec"."activity_2", "ordinv_rec"."sub_class_2", "ordinv_rec"."budget_yn", "ordinv_rec"."budget_year", "ordinv_rec"."op_region_2", "customer"."activity"
 FROM   "dbase"."dbo"."customer" "customer" 
FULL OUTER JOIN "dbase"."dbo"."ordinv_rec" "ordinv_rec" ON "customer"."customer_code"="ordinv_rec"."operator"
 WHERE  "ordinv_rec"."date_created">={ts '2015-01-01 00:00:00'} 
AND ("ordinv_rec"."status_2"='DELIVERED' OR "ordinv_rec"."status_2"='LETTER OF INTENT' OR "ordinv_rec"."status_2"='LIVE') 
AND ("ordinv_rec"."budget_year"=0 OR "ordinv_rec"."budget_year"=2016)

基本上"customer"."veh_capex_2016"字段显示该运算符的单个值,例如100英镑,我需要在"customer"."veh_capex_2016"和我的VARIANCE公式{customer.veh_capex_2016}-{@Total Committed YTD}之间计算方差,但在摘要中插入此方法会返回多个值。即{customer.veh_capex_2016}乘以订单数量,然后扣除{@Total Committed YTD}而不是仅返回单个字段值

非常感谢任何帮助或建议。

0 个答案:

没有答案