Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 497E96367B8 for ; Sat, 31 Oct 2009 18:11:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 44037-10 for ; Sat, 31 Oct 2009 21:11:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout01.t-online.de (mailout01.t-online.de [194.25.134.80]) by mail.postgresql.org (Postfix) with ESMTP id 9F95F63566E for ; Sat, 31 Oct 2009 18:11:31 -0300 (ADT) Received: from fwd06.aul.t-online.de by mailout01.t-online.de with smtp id 1N4LEN-0000Ub-01; Sat, 31 Oct 2009 22:11:27 +0100 Received: from miraculix.hinkelstein (XV8jTUZ6QhJGyetLegNA3frWlIQBGqt00-it-IfftYE-UQ7IteGbAxVYv-K+LQVgBy@[93.204.42.163]) by fwd06.aul.t-online.de with esmtp id 1N4LED-0JfGr20; Sat, 31 Oct 2009 22:11:17 +0100 Received: by miraculix.hinkelstein (Postfix, from userid 1000) id 41D6234745E6; Sat, 31 Oct 2009 22:11:06 +0100 (CET) Date: Sat, 31 Oct 2009 22:11:06 +0100 From: Bernd.Nawothnig@t-online.de (Bernd Nawothnig) To: "Little, Douglas" Cc: "pgsql-sql@postgresql.org" Subject: Re: how to: refer to select list calculations other places in the calculations. Message-ID: <20091031211106.GA9238@miraculix> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-ID: XV8jTUZ6QhJGyetLegNA3frWlIQBGqt00-it-IfftYE-UQ7IteGbAxVYv-K+LQVgBy X-TOI-MSGID: 4bfa57a7-743c-4b1c-9a39-f308dea908fb X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.11 tagged_above=-10 required=5 tests=BAYES_05=-1.11 X-Spam-Level: X-Archive-Number: 200911/30 X-Sequence-Number: 33381 On Wed, Sep 09, 2009 at 08:27:35AM -0500, Little, Douglas wrote: > I have very complex sql (generated by cognos) I'm porting from > Teradata that basically uses column alias in the calculated columns. > Is there any way to do this type of thing in Psql? I use nested subqueries and do the renaming of calculated columns in the innermost queries in such cases. Bernd