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 |
|
oayata
Starting Member
1 Post |
Posted - 2009-12-09 : 08:20:58
|
| Hi,I have a simple table consisting of codes and amounts:code, amount1, amount21, 34, 78 2, 45, 18 3, 15, 37.. .. .. What SQL statement should I use to get sum of amounts with some specific codes, like:sumof(amt1 w/code = 1), sumof(amt1 w/code = 2), sumof(amt1 w/ code = 3) ....., ....,....sumof(amt2 w/code = 1), sumof(amt2 w/code = 2), sumof(amt2 w/code = 3) ..... ,...., ....Note: Let say there are codes from 1 to 10 in the table.I want to get only code values of 3,5 and 7 and the sum of those codes' amounts (amount1, amount2) side by side on a SQL result.Thanks in advance,Devrim |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-12-09 : 08:58:22
|
| We'll help with your homework, some will even do it for you, but you have to give it a try yourself. What have you come up with so far as a possible solution?JimEveryday I learn something that somebody else already knew |
 |
|
|
|
|
|
|
|