title: Sum Decode statement SQL
body: <p>I am trying to sum a few <code>Decode</code> statements and column names, but am having difficulties.</p>
  
  <p>currently it is showing as</p>
  
  <pre><code> rank | name | points
  ----------------------
    0   | john |   0
    0   | john |  40
    1   | john |  30
    2   | tom  |  22
    0   | tom  |   0
  </code></pre>
  
  <p>I expect to have this result:  </p>
  
  <pre><code> rank | name | points
  ----------------------
    1   | john |  70
    2   | tom  |  22
  </code></pre>
  
  <p><strong>Query:</strong></p>
  
  <pre><code>Select Rank, Name, Code, Points
    From
     (select 
          decode(Table.name, 'condition1', Table.value) As Points,
          decode(Table.name, 'Condition2', Table.value) As Rank,
          Employee.name as Name,
          Employee.GA1 as Code
        from Table
        inner Join Employee
           on Empolyee.positionseq = name.positionseq
        where Table.name IN ('Condition1', 'Condition2')
      );
  </code></pre>