Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sum a column and get a Total

Author  Topic 

Michael71
Posting Yak Master

126 Posts

Posted - 2006-10-13 : 15:00:11
I have a Monthlyexpense column. How do I Sum up this column and put the Total in my ytdexpenses column. I think I figure out the query, but I don't know where to write the query at. Please help.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-13 : 15:05:57
Is this what you mean?

UPDATE YourTable
SET ytdexpenses = SUM(Monthlyexpense)

You put the query in Query Analyzer or Management Studio (depending on your dbms version).

Tara Kizer
Go to Top of Page

Michael71
Posting Yak Master

126 Posts

Posted - 2006-10-13 : 15:13:01

I know I'm new to this SQL Server stuff. I'm going to try that. Thanks. I'll let you know if it works.

Michael71
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-14 : 04:20:51
duplicate post of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=73499


KH

Go to Top of Page
   

- Advertisement -