0
votes

My table name is "accounting"

it has two columns named "Debit" and "Credit"

Is it possible to have the sum of these two columns?

example:

               INPUT:                      
      Debit              Credit                     
       200        +      -100      
       300        +      -300   
       500        +      -400      
     --------          ----------                  
      1000               -800

I want it to appear like this in my Crystal Report:

Debit              Credit              TOTAL                    
  200               -100                100
  300               -300                 0 
  500               -400                100
--------          ----------          ---------        
  1000               -800               200

I dont know what FORMULA I should use in Crystal Report

1

1 Answers

0
votes

it is good if you this done in sqlserver as add a column with summary like

select 
    Debit, Credit, Debit+Credit as Total
from yourtable

If you wish in crystal report side, then also it is possible.

Add one variable and write this as below and put near this fields in detail section.

{@yourtablename.DebitField} + {@yourtablename.creditField} //I forgot the syntax, please change aproopriate.

Adding Sum of fields of two tables giving strange result in Crystal Report

http://vbcity.com/forums/t/154231.aspx