title: can MySQL temporary variables be used in WHERE clause?
body: <p>In MySQL, can temporary variables be used in the <code>WHERE</code> clause?</p>
  
  <p>For example, in the following query:</p>
  
  <pre><code>SELECT `id`, @var := `id` * 2 FROM `user`
  </code></pre>
  
  <p>@var is successfully set to twice the value of `id`</p>
  
  <p>However, if I try to filter the result set to only include results where @var is less than 10:</p>
  
  <pre><code>SELECT `id`, @var := `id` * 2 FROM `user` WHERE @var &lt; 10
  </code></pre>
  
  <p>then I get no results.</p>
  
  <p>How can I filter the results based on the value of @var?</p>