Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 2089A476CAB for ; Wed, 19 Jun 2002 20:00:09 -0400 (EDT) Received: from ece.rice.edu (ece.rice.edu [128.42.4.34]) by postgresql.org (Postfix) with ESMTP id EB3E147674E for ; Wed, 19 Jun 2002 19:56:21 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by ece.rice.edu (Postfix) with ESMTP id 758FF68A5B; Wed, 19 Jun 2002 18:56:23 -0500 (CDT) Received: from wallace.ece.rice.edu (wallace.ece.rice.edu [128.42.12.154]) by ece.rice.edu (Postfix) with ESMTP id B8C3168A57; Wed, 19 Jun 2002 18:56:22 -0500 (CDT) Received: from reedstrm by wallace.ece.rice.edu with local (Exim 3.34 #1 (Debian)) id 17KpJG-0000xI-00; Wed, 19 Jun 2002 18:56:22 -0500 Date: Wed, 19 Jun 2002 18:56:22 -0500 From: "Ross J. Reedstrom" To: Michael Agbaglo Cc: Wei Weng , pgsql-sql@postgresql.org Subject: Re: syntax for access an alias in the where clause ? Message-ID: <20020619235622.GA3650@rice.edu> Mail-Followup-To: "Ross J. Reedstrom" , Michael Agbaglo , Wei Weng , pgsql-sql@postgresql.org References: <3D10C770.7040100@shifted-bytes.de> <1024516580.20296.8.camel@Monet> <3D10F3FB.6090706@shifted-bytes.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D10F3FB.6090706@shifted-bytes.de> User-Agent: Mutt/1.3.27i X-Virus-Scanned: by AMaViS snapshot-20010714 X-Archive-Number: 200206/263 X-Sequence-Number: 8228 On Wed, Jun 19, 2002 at 11:13:31PM +0200, Michael Agbaglo wrote: > > > Wei Weng wrote: > > >Is it allowed to use spaces in postgresql alias? > > > >Why dont you try to use alias1 instead of "alias 1"? > > > > really amusing... muhahaha... I'm sure he didn't mean to make a joke, nor ridicule you, it was just a misundertanding. > I don't use the brackets either... I didn't assume that you might be > interested in how the expression looks like or what aliases I'm using... Sometimes, it makes all the difference. In this case, it doesn't. Aliases are not available in the 'order by' clause: you need to repeat te full expressions there. Ross > > > > > > > >On Wed, 2002-06-19 at 14:03, Michael Agbaglo wrote: > > > >>Hi ! > >> > >>It's long ago since I used SQL :-) > >> > >>select [expression 1] as [alias 1], [expression 2] as [alias 2] > >>where [alias 1] < [alias 2] > >>order by [alias 2] - [alias 1] > >> > >>---> ERROR: Attribute '[alias 1]' not found > >> > >>I found a lot of 'select [expression] as' but I've never seen somebody > >>accessing the alias ... Can't this be done ? > >> > >>M. > >> > >> > >> > >> > >>---------------------------(end of broadcast)--------------------------- > >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > >> > >> > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org