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 |
|
JeffK627
Yak Posting Veteran
50 Posts |
Posted - 2010-06-03 : 13:49:28
|
| I have data that looks like this:[Date] [Total] [A] [B] [C] [D] [E]2010-06-02 630 0 0 0 0 42010-06-02 630 601 0 0 0 02010-06-02 630 0 0 2 0 02010-06-02 630 0 7 0 0 02010-06-02 630 0 0 0 16 0I need to combine those rows it so it looks like this:[Date] [Total] [A] [B] [C] [D] [E]2010-06-02 630 601 7 2 16 4Any relatively easy way to do that without a cursor? |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-06-03 : 13:52:43
|
| Just sum it up!SELECT Date,[Total],sum([a]) as A,sum([B]) as B etc.FRom yourTableGROUP BY Date,[Total],JimEveryday I learn something that somebody else already knew |
 |
|
|
JeffK627
Yak Posting Veteran
50 Posts |
Posted - 2010-06-03 : 15:10:37
|
| That worked great - thanks! I should have thought of that - need more caffeine... |
 |
|
|
|
|
|