Visual studio 2008 水晶报告总结
所以我分两组 tblTenant.ID tblTransaction.TenantID 在tblTransactions中,有两个字段我要操作,AmountCharged和AmountPaid。如何对两个字段求和,然后按组减去它们?也就是说,每个承租人将对其所有已收取的金额进行汇总,然后对其已支付的金额进行汇总和减去 例如,SQL将是:Visual studio 2008 水晶报告总结,visual-studio-2008,crystal-reports,Visual Studio 2008,Crystal Reports,所以我分两组 tblTenant.ID tblTransaction.TenantID 在tblTransactions中,有两个字段我要操作,AmountCharged和AmountPaid。如何对两个字段求和,然后按组减去它们?也就是说,每个承租人将对其所有已收取的金额进行汇总,然后对其已支付的金额进行汇总和减去 例如,SQL将是: SELECT SUM(tblTransactions.AmountCharged) - SUM(tblTransactions.AmountPaid) FROM
SELECT SUM(tblTransactions.AmountCharged) - SUM(tblTransactions.AmountPaid) FROM tblTransactions
Where tblTrascactions.TenantID = x
其中“x”是组的租户id。我能想到的最简单的方法是在详细信息行上创建一个公式字段,该字段为AmountCharged AmountPaid,并将其隐藏。然后只需右键单击它,并在组中插入一个总和。可以用一个水晶公式完成
SUM({tblTransactions.AmountCharged}, {tblTrascactions.TenantID}) -
SUM({tblTransactions.AmountPaid}, {tblTrascactions.TenantID})
或
然后在tenantID组页脚中显示该公式。就是这样!非常感谢。
SUM({tblTransactions.AmountCharged} - {tblTransactions.AmountPaid}, {tblTrascactions.TenantID})