This topic is locked
[SOLVED]

 bank account balance with phprunner

12/1/2011 7:07:18 AM
PHPRunner General questions
A
amoratorio author

Hi, I wonder whether you can use mysql variables query manager.

The problem is: I need to get a balance sheet with carryover balances, that's what I try to use SET @ balance: = 0; before my query but will not let me query manager.

Is it possible? Them any ideas? This is my table structure:
trans_no

type

version

debtor_no

branch_code

tran_date

due_date

ov_amount

ov_gst

ov_freight

ov_freight_tax

ov_discount

alloc

rate

payment_terms

Outstanding

Total_Amt
group by trans_no,type and order by trans_no,type.

Where total_amt is> 0 or <0 depending on whether it Debit and Credit, I need to add and accumulate them in a variable so that the values ​​go plus or minus according to the sign they have.

Example total_amt = 9, the first record, total_amt =- 2 in the second and total_amt = 6 in the third, the variable @ balance = @ balance + total_amt, thus: 9-2 +6 = 13.
Thanks in advance.