title: MySQL Running Total with COUNT
body: <p>I'm aware of the <code>set @running_sum=0;</code> <code>@running_sum:=@running_sum + ...</code> method, however, it does not seem to be working in my case.</p>
  
  <p>My query: </p>
  
  <pre><code>SELECT DISTINCT(date), COUNT(*) AS count 
     FROM table1
     WHERE date &gt; '2011-09-29' AND applicationid = '123'
     GROUP BY date ORDER BY date
  </code></pre>
  
  <p>The result gives me unique dates, with the count of occurrences of application 123.</p>
  
  <p>I want to keep a running total of the <code>count</code>, to see the accumulated growth.</p>
  
  <p>Right now I'm doing this in PHP, but I want to switch it all to MySQL.</p>
  
  <p>Using the method from the first line of this post simply duplicates the count, instead of accumulating it.</p>
  
  <p>What am I missing?</p>
  
  <p>P.S. The set is very small, only about 100 entries.</p>
  
  <p>Edit: you're right ypercube:</p>
  
  <p>Here's the version with running_sum:</p>
  
  <pre><code>SET @running_sum=0;
  SELECT date, @running_sum:=@running_sum + COUNT(*) AS total FROM table1
     WHERE date &gt; '2011-09-29' AND applicationid = '123'
     GROUP BY date ORDER BY date
  </code></pre>
  
  <p>count column ends up being the same as if I just printed COUNT(*)</p>