title: How does where clause of cumulative sum works?
body: <p>So, I have a table call order and consist of two result which consist of a value.</p>
  
  <p>When I execute this query:</p>
  
  <pre><code>SELECT @running_total := @running_total + orders.myVal AS cumulative_sum
  From orders JOIN
       (SELECT @running_total := 0) r
  </code></pre>
  
  <p>It return this result:</p>
  
  <pre><code>_____________________
  |id | cumulative_sum |
  |___|________________|
  | 1 |             1  |
  |___|________________|
  | 2 |             3  |
  |___|________________|  
  </code></pre>
  
  <p>However when I add a where clause <code>WHERE @running_total &lt;= 0.5</code></p>
  
  <p>which is </p>
  
  <pre><code>SELECT @running_total := @running_total + orders.myVal AS cumulative_sum
  From orders JOIN (SELECT @running_total := 0) 
  WHERE @running_total &lt;= 0.5
  </code></pre>
  
  <p>Why does it return the same result? </p>
  
  <p>In my knowledge, it shouldnt return any result as both of the result does not contain anything less than 0.5</p>
  
  <p>Thanks</p>