How to do the row to column SUMIF in MS SQL Server -


suppose have table called "table-a", sumifs image

enter image description here

for total sum , group by have columns lay-out 1 have not it

in addition, know if doable because there might new statuses database grows, there anyway make column header item in status?

thanks

you can try this..

select person,            sum(part)as part,            sum(case when status='a' 1 end) status-a,            sum(case when status='b' 1 end) status-b,            sum(case when status='c' 1 end) status-c             table-a            group person; 

Comments