title: Calculate Win/Loss Streak Query
body: <p>I'm trying to find a way to calculate win/loss streak for a user. My table has a field defined as "W/L" and each win is entered as "W" and each loss is entered as "L" Here is what the current table looks like:</p>
  
  <pre><code>ID   Result
  
  1    L
  
  2    W
  
  3    W
  
  4    W
  </code></pre>
  
  <p>Here is an example I found, seems pretty straight forward but I'm apparently missing an operator though. Not sure what I'm missing.</p>
  
  <pre><code>SELECT SUM(CASE WHEN Result = 'W' THEN 1 ELSE 0 END) as Wins, 
         SUM(CASE WHEN Result = 'L' THEN 1 ELSE 0 END) as Losses 
  FROM Table1
  </code></pre>
  
  <p>Is it best to create a query for this or more suited for a VBA type function?</p>