title: mysql - why condition where is not work?
body: <pre><code>SELECT
      t1.user_id,
      count(*) total,
      sum(case when t1.var1 = 'yes' then 1 else 0 end) as type1,
      sum(case when t1.var1 = 'no' then 1 else 0 end) as type2
  FROM table as t1
  WHERE type1 &gt; 0
  GROUP by t1.user_id
  ORDER by type1 DESC
  LIMIT 100
  </code></pre>
  
  <p>In result i get rows:</p>
  
  <pre><code>user_id  total  type1  type2
    1       100    80     20
    4       120    70     50
    6       90     0      90
  </code></pre>
  
  <p>Tell me please why condition <code>WHERE type1 &gt; 0</code> not work and how select rows with this condition ?</p>