•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 425,899 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 1,923 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 MS SQL advertiser: Programming Forums
Views: 757 | Replies: 2
![]() |
•
•
Join Date: Jun 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
I would like to SUM two fileds from different rows from the same table but I don't know how to do that.
E.g.
BillingTransactionsIndex CreateDate UserType UserIndex TransType Reference Total Balance
2 6/5/2008 15:02 1 51 1 150 -288.2 -288.2
5 6/8/2008 11:55 1 51 1 157 -1.58674 -289.787
In the table above I want SUM fields Total and Balance for the first row and the the next row SUM 2nd row Total with 1st row Balance
Please help
Thanks
E.g.
BillingTransactionsIndex CreateDate UserType UserIndex TransType Reference Total Balance
2 6/5/2008 15:02 1 51 1 150 -288.2 -288.2
5 6/8/2008 11:55 1 51 1 157 -1.58674 -289.787
In the table above I want SUM fields Total and Balance for the first row and the the next row SUM 2nd row Total with 1st row Balance
Please help
Thanks
•
•
Join Date: Apr 2008
Posts: 295
Reputation:
Rep Power: 1
Solved Threads: 41
Hi tkotey
Similar problem we have discussed on http://www.daniweb.com/forums/thread127644.html.
you may investigate SQL code from posts #5 and #7 where I gave solutions on how to compute balance values from consecutive rows. You can adapt that code so it fits your specific requirements. If you have further problems we can discuss them here.
krs,
tesu
Similar problem we have discussed on http://www.daniweb.com/forums/thread127644.html.
you may investigate SQL code from posts #5 and #7 where I gave solutions on how to compute balance values from consecutive rows. You can adapt that code so it fits your specific requirements. If you have further problems we can discuss them here.
krs,
tesu
![]() |
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Null value in view
- Next Thread: data type


Linear Mode