title: Max and Decode convert in SQL Server
body: <p>I want to convert this piece of the query to run in SQL Server its taken from an Oracle query:</p>
  
  <pre><code>SELECT    
      x.JudgmentMonth,
      MAX(DECODE(x.RecordType, '1', x.Volumes)) CONSUMER,
      MAX(DECODE(x.RecordType, '2', x.Volumes)) COMMERCIAL
  FROM    
      (SELECT    
           r.JudgmentMonth, r.RecordType, r.Volumes
       FROM    
           dset r) x
  GROUP BY 
      x.JudgmentMonth
  </code></pre>
  
  <p>I am not familiar with SQL Server any help will much appreciated. </p>