Vb.net 什么';在crystal report中执行此操作的最佳方法是什么?

Vb.net 什么';在crystal report中执行此操作的最佳方法是什么?,vb.net,crystal-reports,Vb.net,Crystal Reports,在crystal report中实现这一点的最佳方法是什么?我有三个表,主表,主表的子表,另一个是子表的子表的项目表。它是这样的 MainTable - stored the main accounts. idKey Accnt Amount ------------------------------------ 01 Construction 1000.00 02 Maintenance 500.00

在crystal report中实现这一点的最佳方法是什么?我有三个表,主表,主表的子表,另一个是子表的子表的项目表。它是这样的

MainTable - stored the main accounts.

idKey       Accnt           Amount
------------------------------------
01          Construction     1000.00
02          Maintenance       500.00


SubTable - this table where sub account for the main table stored.
         - the idkey from this table and main table is equal.

idKey    idSub   SubAccnt               Amount
-----------------------------------------
01          01   WatchTower             800.00
01          02   Level 9 Wall           200.00
02          03   Monthly Maintenance    500.00

itemTable - this table where the items of the sub table stored.
          - the idsub of this table and the SubTable is equal.

idSub       Items        Cost
-----------------------------------
01          Cement       100.00
01          Steel        100.00
01          Labor        400.00
02          Rocks        100.00
02          Labor        100.00
03          Labor        500.00
现在我希望报告是这样的

MainTable - stored the main accounts.

idKey       Accnt           Amount
------------------------------------
01          Construction     1000.00
02          Maintenance       500.00


SubTable - this table where sub account for the main table stored.
         - the idkey from this table and main table is equal.

idKey    idSub   SubAccnt               Amount
-----------------------------------------
01          01   WatchTower             800.00
01          02   Level 9 Wall           200.00
02          03   Monthly Maintenance    500.00

itemTable - this table where the items of the sub table stored.
          - the idsub of this table and the SubTable is equal.

idSub       Items        Cost
-----------------------------------
01          Cement       100.00
01          Steel        100.00
01          Labor        400.00
02          Rocks        100.00
02          Labor        100.00
03          Labor        500.00


如何做到这一点?我需要这方面的子报告吗?怎么做?使用crystal report和VB.NET..很高兴得到任何帮助..tnx提前:)

此查询可能会帮助您

  Select MT.Accnt,ST.SubAccnt, ST.amount,sum(IT.cost) from MainTable MT
    inner join SubTable ST on ST.idKey=MT.idKey       
    inner join itemTable IT on IT.idSub=ST.idSub
    Group By MT.Accnt,ST.SubAccnt, ST.amount
子报表不是必需的,对于余额,您可以在查询中实现,也可以在报表本身中实现


为MT.Accnt添加组,并为其添加总计。

此查询可能会帮助您解决问题

  Select MT.Accnt,ST.SubAccnt, ST.amount,sum(IT.cost) from MainTable MT
    inner join SubTable ST on ST.idKey=MT.idKey       
    inner join itemTable IT on IT.idSub=ST.idSub
    Group By MT.Accnt,ST.SubAccnt, ST.amount
子报表不是必需的,对于余额,您可以在查询中实现,也可以在报表本身中实现


为MT.Accnt添加组,并为其添加总计。

我将尝试此mate..tnx:)我将尝试此mate..tnx:)