User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 456,272 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,408 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums

how to calculate the value of one row to another

Join Date: Nov 2006
Posts: 14
Reputation: kutta_vin is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
kutta_vin kutta_vin is offline Offline
Newbie Poster

Re: how to calculate the value of one row to another

  #8  
Jun 17th, 2008
Hi tesuji,

the problem solved for me with your old query idea, that is with the help of

(SELECT transaction, credit, debit, credit+coalesce((SELECT sum(credit)

FROM act b WHERE b.transaction < a.transaction),0) AS sumCredit,

debit+coalesce((SELECT sum(debit) FROM act b

WHERE b.transaction < a.transaction),0) AS sumDebit,

sumCredit - sumDebit AS Balance FROM act a ORDER BY transaction; )

this query. But the alias names sumCredit - sumDebit cannot be evaluated with only alias names , i used the same condition for that ,( credit+coalesce((SELECT sum(credit)
FROM act b WHERE b.transaction < a.transaction),0))-(debit+coalesce((SELECT sum(debit) FROM act bWHERE b.transaction < a.transaction),0)).
Reply With Quote  
All times are GMT -4. The time now is 6:32 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC