title: PostgreSQL - Aliases column and HAVING
body: <pre><code>SELECT  
  CASE WHEN SUM(X.Count)*3600 is null THEN  '0'  
              ELSE  
              SUM(X.Count)*3600  
         END AS PJZ,  
         X.Mass  
  FROM X  
  WHERE X.Mass &gt; 2000  
  HAVING ((X.Mass / PJZ * 100) - 100) &gt;= 10;
  </code></pre>
  
  <p>Getting: ERROR:  Column »pjz« doesn't exists.</p>
  
  <p>How can I do something like this?</p>