Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 51503632753 for ; Wed, 24 Mar 2010 13:42:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 95239-02 for ; Wed, 24 Mar 2010 16:42:28 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hosting.mactelecom.net (hosting.mactelecom.net [217.64.240.243]) by mail.postgresql.org (Postfix) with ESMTP id DEA9363224C for ; Wed, 24 Mar 2010 13:42:28 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by hosting.mactelecom.net (Postfix) with ESMTP id 290ECE0067 for ; Wed, 24 Mar 2010 16:42:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at BRUBLUcs02.mactelecom.local Received: from hosting.mactelecom.net ([127.0.0.1]) by localhost (BRUBLUcs02.mactelecom.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3qpH3ZopTdc5 for ; Wed, 24 Mar 2010 16:42:23 +0000 (UTC) Received-SPF: none (eurofer.be: No applicable sender policy available) receiver=BRUBLUcs02.mactelecom.local; identity=mfrom; envelope-from="G.De_Leeuw@eurofer.be"; helo=smtp.eurofer.be; client-ip=217.64.254.218 Received: from smtp.eurofer.be (217.64.254.218.mactelecom.net [217.64.254.218]) by hosting.mactelecom.net (Postfix) with ESMTP id D1F79E0066 for ; Wed, 24 Mar 2010 16:42:23 +0000 (UTC) Received: from [192.168.5.10] by smtp.eurofer.be with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NuTen-0006cM-FU for pgsql-admin@postgresql.org; Wed, 24 Mar 2010 17:42:26 +0100 Message-ID: <4BAA40E2.3000805@eurofer.be> Date: Wed, 24 Mar 2010 17:42:10 +0100 From: Guy Deleeuw User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); fr; rv:1.9.1.8) Gecko/20100227 Lightning/1.0b1 Thunderbird/3.0.3 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam_score: -3.6 X-SA-Exim-Connect-IP: 192.168.5.10 X-SA-Exim-Mail-From: G.De_Leeuw@eurofer.be Subject: How to use an alias name in the current select X-SA-Exim-Scanned: Yes (on smtp.eurofer.be) X-All-Recipients: pgsql-admin@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=-10 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201003/182 X-Sequence-Number: 33981 Hello I have : SELECT t_orders_articles.k_id AS k_id ,t_orders_articles.quantity AS order_qty ,(SELECT sum(quantity) FROM t_deliveries_articles WHERE article_id = t_orders_articles.k_id) AS delivery_qty , (t_orders_articles.quantity - delivery_qty) AS qty FROM t_orders_articles ......; But it's not working I receive the error : ERROR : The column delivery_qty does not exist. How can I make that without having 2 select call ? Regards Guy