SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Trying to Sum monthlyExpenses to ytdExpenses
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Michael71
Posting Yak Master

USA
126 Posts

Posted - 10/16/2006 :  12:09:41  Show Profile  Reply with Quote
I have a Monthlyexpense column. How do I Sum up this column and put the Total in my ytdexpenses column. Do I use a stored procedure, because I want the monthlyExpenses to SUm up every time I submit a monthly expense to the database and siplay in the ytdExpenses Column.
When I Write a Query all of the rows in the ytdExpenses shows the same amount and do not total up every time I submit to the database. Help please.

monthlyExpenses ytdExpenses
$1,000 $1,000
$2,000 $3,000
$3,000 $6,000
$2,000 $8,000
$5,000 $13,000

khtan
Flowing Fount of Yak Knowledge


Singapore
3773 Posts

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 10/16/2006 :  12:24:47  Show Profile  Reply with Quote
If you want a total, you actually have to program it. Just calling it YTD Expenses will not get data into the column.

Also, your table doesn't make much sense to me. If you have a column for monthlyExpenses, how do you know which month it is or who the expsnse is for?



CODO ERGO SUM

Edited by - Michael Valentine Jones on 10/16/2006 12:25:12
Go to Top of Page

Michael71
Posting Yak Master

USA
126 Posts

Posted - 10/16/2006 :  12:28:13  Show Profile  Reply with Quote
Michael Valentine....the month is for the date it was filled out...it's for that department...I know you have to program it...but with what?
Go to Top of Page

Michael71
Posting Yak Master

USA
126 Posts

Posted - 10/16/2006 :  12:30:09  Show Profile  Reply with Quote
Can Anyone help me out...instead of asking questions that I already know.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 10/16/2006 :  12:34:57  Show Profile  Reply with Quote
Your table doesn't have the data element month or department, so how do you kwow? Or did you just not provide that information?



CODO ERGO SUM
Go to Top of Page

Michael71
Posting Yak Master

USA
126 Posts

Posted - 10/16/2006 :  12:40:01  Show Profile  Reply with Quote
It's only one department and I did not provide that information? What do you mean about data Element?
Go to Top of Page

Michael71
Posting Yak Master

USA
126 Posts

Posted - 10/16/2006 :  12:42:19  Show Profile  Reply with Quote
All I want to do is Sum up the monthlyExpenses and update the ytdExpenses everytime I submit data to the database.
Go to Top of Page

Michael71
Posting Yak Master

USA
126 Posts

Posted - 10/16/2006 :  13:08:08  Show Profile  Reply with Quote
CAn anyone help me out Please
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30213 Posts

Posted - 10/16/2006 :  14:02:57  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Close this topic and continue here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=73584


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000