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 |
|
natg504
Starting Member
14 Posts |
Posted - 2011-04-01 : 12:01:28
|
| I have a table with data in the following format:DateRecorded __ CategoryID __ ValueJanuary 2010 ---- 1 ----------- 5January 2010 ---- 2 ----------- 10January 2010 ---- 3 ----------- 15February 2010 --- 1 ----------- 20February 2010 --- 2 ----------- 25February 2010 --- 3 ----------- 30March 2010 ------ 1 ----------- 35March 2010 ------ 2 ----------- 40March 2010 ------ 3 ----------- 45Is there any way that I can do a single SQL query to sum the values for each month, so it would return something like this?DateRecorded __ Summed ValueJanuary 2010 ------- 30February 2010 ------ 75March 2010 --------- 120 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-04-01 : 12:02:36
|
| select DateRecorded , sum(value) as value from tablegroup by DateRecordedMadhivananFailing to plan is Planning to fail |
 |
|
|
natg504
Starting Member
14 Posts |
Posted - 2011-04-01 : 12:27:05
|
| Thanks, that is what I was looking for. |
 |
|
|
|
|
|