title: How to write multiple queries in one query based on condition in SQL Server?
body: <pre><code>SELECT 
      [LNMAJORTP], [MainType],
      SUM(x + y - z) [x]
  FROM 
      [my_table]  
  WHERE 
      state LIKE '%firstCondition%'
  GROUP BY
      [LNMAJORTP], [MainType] 
  
  SELECT 
      [LNMAJORTP], [MainType],
      SUM(x + y - z) [y]
  FROM 
      [my_table]  
  WHERE 
      state LIKE '%secondCondition%'
  GROUP BY
      [LNMAJORTP], [MainType] 
  
  SELECT 
      [LNMAJORTP], [MainType],
      SUM(x + y - z) [z]
  FROM 
      [my_table]  
  WHERE
      state LIKE '%thirdCondition%'
  GROUP BY
      [LNMAJORTP], [MainType]
  </code></pre>
  
  <p>How I can change this queries to one query?</p>