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 |
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2005-01-20 : 12:11:28
|
I have a table looks like:Id High LowA 100 50B 250 78C 300 56D 120 88E 176 43 I want to generate the output looks like: Id High LowA 100 50B 250 78Other(C+D+E) 596 187 Thanks! |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
Posted - 2005-01-20 : 12:23:53
|
| Is this what you wantSELECT (CASE WHEN Id IN ('A','B') THEN Id ELSE 'Other' END) AS Id, SUM(High) AS High, SUM(Low) AS LowFROM MyTableGROUP BY (CASE WHEN Id IN ('A','B') THEN Id ELSE 'Other' END) |
 |
|
|
|
|
|