How to make a sum of total for each id

≯℡__Kan透↙ 提交于 2019-12-31 06:19:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!