问题
Using Crystal report 7
I want to view the table 1 and sum of table2
table1
id name
001 raja
002 vijay
003 suresh
....
table2
id value
001 100
001 200
001 150
002 200
003 150
003 200
...
I want to display all the rows from table1 and sum(values) from table2. How to do this in crystal report
Expected Output
id name value
001 raja 450
002 vijay 200
003 suresh 350
................
1000 (sum of value)
Note: I add the table field directly to the report, i am not added store procedure or views or query in the report.
How to do this.
Need Crystal report help
回答1:
Try this it will work for you
1) Add a Group in your crystal report i.e. by Name

2) Add a running total


3) your report will be as follow

4) Your output will be

回答2:
Join Table 1 and Table 2 on ID.
Add the fields ID, Name, and Value to your report.
Group the report on ID and Insert a Summary field (SUM) on VALUE to the Group Header.
Add Name to the Group Header.
Add a Grand Total (Report Footer) on Value.
Hide or Supress the Details band.
This will give you the same as you desire, but without the necessity of Running Totals and resets.
来源:https://stackoverflow.com/questions/11186444/how-to-make-a-sum-of-total-for-each-id