title: Filter by count from another table
body: <p>This query works fine only without <code>WHERE</code>, otherwise there is an error:</p>
  
  <blockquote>
    <p>column "cnt" does not exist</p>
  </blockquote>
  
  <pre><code>SELECT
    *,
    (SELECT count(*)
     FROM B
     WHERE A.id = B.id) AS cnt
  FROM A
  WHERE cnt &gt; 0
  </code></pre>