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.
| Author |
Topic |
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2005-09-22 : 10:28:20
|
| Can anyone tell me how I can sum records within a column? I was referencing the specific records I needed with the date column, but the dates continually change based on my input, so I need to be able to tell sql to move up the column as opposed to telling it to grab the records which correspond to specific dates. Any help would be appreciated,Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-22 : 10:34:43
|
| Can you post table Structure, sample data and the result you want?MadhivananFailing to plan is Planning to fail |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2005-09-22 : 10:35:21
|
| SELECT SUM(myColumn) AS [My happy sum column] FROM MyTable WHERE (conditions)Help us help YOU!Read this blog entry for more details: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx*need more coffee*SELECT * FROM Users WHERE CLUE > 0(0 row(s) affected) |
 |
|
|
dirwin26
Yak Posting Veteran
81 Posts |
Posted - 2005-09-22 : 10:58:04
|
| #Table structureID Revnues Date7 100 2005-10-17 100 2005-11-17 100 2005-12-1I need to add the revenues for november and december. I am having problems using the WHERE clause because the date will change depending on which Id is displayed in the temp table. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-22 : 11:08:04
|
| Is this?Select sum(Revenues) from yourTable where Datecol between Date1 and Date2MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|