title: Column doesn't exist?
body: <p>Was wondering if someone could help me out a little with this query:</p>
  
  <pre><code>SELECT u1.id,count(DISTINCT u2.userstatus) as TEMPCOLUMN FROM users AS u1
  JOIN friendssym ON u1.id = friendssym.user_id
  JOIN (SELECT * FROM users) as u2 ON friendssym.friend_id=u2.id
  WHERE TEMPCOLUMN=1 
  group by u1.id;
  </code></pre>
  
  <p>I want to only have results where the count (which is renamed) is equal to 1. I get an error with this query:  </p>
  
  <pre><code> ERROR:  column "tempcolumn" does not exist
  </code></pre>
  
  <p>But the column <em>should</em> exist, right? Can anyone assist? Thanks!</p>