title: Column wise report with sum values: MYSQL
body: <p><a href="https://i.stack.imgur.com/24Zum.png" rel="nofollow noreferrer">Created table in this pattern</a></p>
  <p>Here, I have created a table with list of products with various companies along with price. Now, am trying to get company wise report in L1_cname, L2_cname &amp; L3_cname with sum of prices. As shown in in below image..</p>
  <p><a href="https://i.stack.imgur.com/fXIPU.png" rel="nofollow noreferrer">Desired output</a></p>
  <p>The output should be expected as below with sum of these prices with respective to Companies A,B &amp; C.... Help me with the desired Output what am missing.....</p>
  <p>Query....</p>
  <pre><code>SELECT L1_cname as L1Company,
  SUM(CASE WHEN L1_cname = 'Company A' THEN L1_price ELSE L1_price END ) AS L1_Total_Price, 
  SUM(CASE WHEN L2_cname = 'Company A' THEN L2_price ELSE L2_price END ) AS L2_Total_Price, 
  SUM(CASE WHEN L3_cname = 'Company A' THEN L3_price ELSE L3_price END ) AS L3_Total_Price,
  SUM((CASE WHEN L1_cname = 'Company A' THEN L1_price ELSE L1_price END )+
  (CASE WHEN L2_cname = 'Company A' THEN L2_price ELSE L2_price END )+
  (CASE WHEN L3_cname = 'Company A' THEN L3_price ELSE L3_price END )) as Baggage_Price 
  FROM test_pricing ;
  </code></pre>