I have a sql server table TestInsertState.
AppliedFor | Node | Amount |
Delay Condonation NOC | 3 | 300 |
Delay Condonation NOC | 5 | 700 |
Mortgage NOC | 1 | 400 |
Mortgage NOC | 4 | 200 |
Delay Condonation NOC | 8 | 400 |
Delay Condonation NOC | 10 | 300 |
Mortgage NOC | 12 | 100 |
Mortgage NOC | 11 | 200 |
i want to display a report that show in below. I am using sqlserver 2012 and i am very new in sql server.if possibe please reply.Thanks in advance
if Node in(3,5,1,4) then 'MTS-1' and if Node in(8,10,11,12) then 'MTS-3' |
|
|
|
| Mts-1 | Mts-3 |
AppliedFor | Amount | Amount |
Delay Condonation NOC | 1000 | 700 |
Mortgage NOC | 600 | 300 |
What I have tried:
select sum(Amount)=
case when TestInsertState.NODE in(1,2,3,4,5,6,7) then 'MTS-1'
when TestInsertState.NODE in(8,9,10,11,12,13) then 'MTS-3'
end ,AppliedName
from TestInsertState
group by AppliedName