I have a report that uses a pair of master-detail type tables: Table A (Parent) and Table B (Child)
The schemas of these two tables is as follows:
Table A
-------
AID
AName
Cost
Table B
-------
AID
BID
BName
TableB's AID is a foreign key referencing Table A's AID
I need to display the report as follows:
AName1 Cost1
BName1
BName2
AName2 Cost2
BName3
BName4
BName5 _________
TotalCost
The problem I am having is in calculating TotalCost. Because of the way I am joining the tables, the TotalCost is coming as Cost1 * 2 + Cost2 * 3, where 2 and 3 are the number of records in B that correspond to the particular records in A.
How can I get TotalCost = Cost1 + Cost2 + ...?
Thanks a lot for your help.
Infimo
The schemas of these two tables is as follows:
Table A
-------
AID
AName
Cost
Table B
-------
AID
BID
BName
TableB's AID is a foreign key referencing Table A's AID
I need to display the report as follows:
AName1 Cost1
BName1
BName2
AName2 Cost2
BName3
BName4
BName5 _________
TotalCost
The problem I am having is in calculating TotalCost. Because of the way I am joining the tables, the TotalCost is coming as Cost1 * 2 + Cost2 * 3, where 2 and 3 are the number of records in B that correspond to the particular records in A.
How can I get TotalCost = Cost1 + Cost2 + ...?
Thanks a lot for your help.
Infimo