Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id AD04F13C6999 for ; Fri, 4 May 2012 07:26:01 -0300 (ADT) Received: from moutng.kundenserver.de ([212.227.17.9]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SQFi4-0007A6-8P for pgsql-sql@postgresql.org; Fri, 04 May 2012 10:26:00 +0000 Received: from [192.168.1.10] (p4FEB8C78.dip0.t-ipconnect.de [79.235.140.120]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0Ln0mX-1RyLXo38ZR-00hrCu; Fri, 04 May 2012 12:25:46 +0200 Message-ID: <4FA3AEA9.6010401@marcelruff.info> Date: Fri, 04 May 2012 12:25:45 +0200 From: Marcel Ruff User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120410 Thunderbird/11.0.1 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: How change col name during query to use it in where clause Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:UbP/AjUwnMoU28jwhTnitcdxtdThqQ6yjbCdCU3U88D b8+o8sMxJjdd0nn9U/an5BP9zb0vS+d28Or8qJfjaWqZpKM4BP IDllgZrf0vMoztiG/SKfbBmA6Uzf0DW81ILM/5QV2VWL5lWUMz gexurqphF8hlW/QZX9eOdsuXGs/MA9WCoIsJTYKodIHOK28+dE BaoGuOuxjHtioZxLbRwrTKK7wXjdttaaf+yTSZl30sGntuzfqw BbfkbVEoebQF30rXVolKBOBg7b+ojoiT/ZWziQf/v/IzkUj8S4 wYpJK7CO0p/q6O1nOyTim2PO4o+0czcMD54nqD30UVW4kW2k9B 8eiuRJVxLpuGOlvNUGas= X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/4 X-Sequence-Number: 36552 Hi, is an alias name not usable in the where clause? select EXTRACT(day from enddate::TIMESTAMP - old_enddate::TIMESTAMP) AS TAGE from account_h where TAGE>5; ERROR: column "tage" does not exist LINE 1: ... TAGE>5 ... Thank you Marcel