Member of the LearnItFirst.com Video Training Network | LearnSqlServer.com | SQL SSIS Training | SQL Programming Tutorials |
LearnSqlServer.com Forums LearnSqlServer.com
Welcome Guest Search | New Posts | Members | Log In | Register

how to take sum of a field Options
RoniDxb
Posted: Friday, August 01, 2008 3:31:28 PM
Rank: Newbie

Joined: 8/1/2008
Posts: 1
Points: 3
Location: U.A.E
Sr.............Debit............. Credit.............Balance
1 .............. 100 ................. - .................. 100
2 .............. 100 ............. ... - ................... 200
3 .............. - ..................50 ................. 150
4 .............. 100 ................ . - ................... 250

we can only put value in Debit or Credit columns.
Balance column should be update automatically.Is it possible. Plz guide me.
Scott Whigham
Posted: Friday, August 01, 2008 3:45:50 PM


Rank: Super Mod

Joined: 3/20/2006
Posts: 345
Points: 748
Location: Dallas, TX
SELECT SUM(Balance) FROM {Table}
Jawad Khan
Posted: Tuesday, August 12, 2008 3:05:43 AM
Rank: Newbie

Joined: 8/7/2008
Posts: 2
Points: 6
Location: Quetta
Can you please explain a little more?

Which column you want to sum up?

I think the balance column here is not needed. You can calculate the Balance as follows.
SELECT SUM(Debit-Credit) As Balance from {Table}.

If you want a running balance column... You can do it when generating reports or displaying data. I don't know what are you using at front end.

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
     
Don't Forget!
LearnItFirst.com
Don't Forget!
LearnWindows2003.com
 
Home | About Us | Support | Contact Us | Privacy | Site Map | Blogs Blogs Refer a Friend and Get a Free Subscription!
© Copyright 2004-2007 LearnItFirst.com LLC. All rights reserved. All trademarks remain the property of their respective owners.
This site is not affiliated in any way with the Microsoft Corporation.