title: How to use an ALIAS in a PostgreSQL ORDER BY clause?
body: <p>I have the following query:</p>
  
  <pre><code>SELECT 
      title, 
      (stock_one + stock_two) AS global_stock
  FROM
      product
  ORDER BY
      global_stock = 0,
      title;
  </code></pre>
  
  <p>Running it in PostgreSQL 8.1.23 i get this error:</p>
  
  <p><strong>Query failed: ERROR: column "global_stock" does not exist</strong></p>
  
  <p>Anybody can help me to put it to work? I need the availale items first, after them the unnavailable items. Many thanks!</p>