Question

SQL Server 2000 ; have 10 rows of DEBIT + CREDIT columns, can SQL tally up the balances for each account?

Asked by: jxharding

hi, this is my table. is it possible do work out the balance via SQL, im currently doing it in .net.
Account   Date                         Debit        Credit      Balance
10139      2007-08-31       2025.91      0.0      0.0
10139      2007-08-31       0.0      3620.11      0.0
10139      2007-09-30       4631.52      0.0      0.0
10139      2007-09-30       0.0      11336.71      0.0
10139      2007-09-30       0.0      14.8801      0.0
12211      2007-08-31       1352.76      0.0      0.0
12211      2007-08-31       0.0      3872.5      0.0

e.g. will be
Account   Date                         Debit        Credit      Balance
10139      2007-08-31       205      0.0      -205
10139      2007-08-31       0.0      305      +100
10139      2007-09-30       0.0      15      +115
12211      2007-08-31       135      0.0      -135
12211      2007-08-31       0.0      325      +190

This question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Sign Up Now!
Asked On
2007-11-30 at 02:24:12ID: 22992716
Tags

SQL

Topic

MS SQL Server

Participating Experts
2
Points
500
Comments
34

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

Companies like CVS, Honeywell, Chevron, Toyoto, TriStar Pictures, the U.S. Army, and Accenture

Stay Ahead of the Competition

Advance your career with Experts Exchange. Plug into technology resources for professional development, including solutions, peer-reviewed articles, tutorials, and live training sessions.

Related Solutions

  1. Total in Debit Credit and Balance query
    For my home database of debits I have to pay, I have a form and a subform. The subform has 4 columns of Debit, Credit, Payment and Balance from 1 to many relationship of 2 tables. Looking for the best way for my query to keep the balan...
  2. Debit  - Credit Calculation
    I'm developing Accounts & Receivable Module. I find difficult when I calcuate the debit credit calculation, for e.g. My report figure should be Date Particular Debit Credit Balance 1/2/2002 Inv 292 ...
  3. work out balance from credit & debit in an acces…
    Hey All! This is the situation: I got a table named MONEY in an access database. The table MONEY has 3 fields which are ID, CREDIT, DEBIT. I would like to create a query that can show the balance on each line... The balance will be CR...
Check out some of our great resources!

Featured Articles

Learn from the Best

Our expert teachers are leaders and respected professionals in their tech field and include over 300 Microsoft MVPs. The best part is they're passionate about sharing their expertise with you!

lrmoore has answered 13,534 questions on Experts Exchange since July 2000 and has more than 18 years experience in the networking industry. The six-time Microsoft MVP's specialties include firewalls, virtual private networking, and network management.

angeliii has answered 40,724 questions on Experts Exchange since March 2000. He is a Microsoft Most Valuable Professional for his work with MS SQL Server & Development. He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

Leew has answered 19,673 questions on Experts Exchange since August 1997. He began working with computers in 1989 with a Turbo running DOS 3.3. Since then he has mastered Windows 2000 and XP operating systems, hard drives/storage and Small Business Server.

Meet a few of our expert instructors

Learn Any Technology

We’ve got experts and training resources for hundreds of technology topics. Whatever you need to learn, Experts Exchange has got you covered.

See all topics That's a lot of topics!

Get Help Anywhere

No matter where you find yourself in need of tech help, Experts Exchange is available for you with mobile site access from your smart phone or tablet.

Available from your iPad, iPhone, and many other mobile devices!

Get full access to the help you need.

Subscribe Now

30-day free trial. Register in 60 seconds.

The Latest Technology News and Tips

New Solutions Everyday

Because of our active community of experts, on average new questions receive their first comment in under 30 minutes.

Top MS SQL Server Questions

       

Hear What our Users are Saying

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

20130405-EE-VQP-041

3 Ways to Join

30-Day Free Trial

What you can do at Experts Exchange:

  • Reach your professional goals
  • Advance your tech skills
  • Learn from expert instructors
  • Get help anywhere, anytime
  • Learn from hundreds of topics

What users are saying

  • I am very new to Crystal Reports and SQL Server databases, but -- with the help of Experts Exchange -- I have been able to meet my deadlines and produce effective products.

    Jan Miller

  • I love EE and have been a member since 2004. I just today started my third contract assignment which I attribute to the skills I am learning from other experts.

    Robert Antonellis

  • It's my sole resource as I'm kind of an MS Access loner at my company. It's like having colleagues available when I run out of my own steam.

    Karen Ruskin