title: How to do the row to column SUMIF in MS SQL Server
body: <p>Suppose I have a table called "TABLE-A", I would like to do the SUMIFS like the image</p>
  
  <p><img src="https://i.stack.imgur.com/GQvbM.jpg" alt="enter image description here"></p>
  
  <p>For the total I could do it by <code>SUM</code> and <code>GROUP BY</code> but to have the columns lay-out like the one I would like to have I could not do it</p>
  
  <p>In addition, I would like to know if this is doable that because there might be new statuses as database grows, is there anyway to make the column header to be item in Status?</p>
  
  <p>Thanks</p>