> SELECT field1 / 2 AS foo, > field2 * 2 AS bar, > foo + bar AS total > WHERE foo < 12; > > The first two fields are fine, it's the third that's a problem. The > database reports > > ERROR: column "foo" does not exist >
First, I think it would be great if this worked - like the alias to an update table added in 8.2 - saves a lot of typing and makes queries much more readable. Second, only way I see is to set this on top of a view generating your foo and bar aliases, and go from there. Compared to rewriting the expression each time, it has the advantages of better syntax in the end and might yield better performance as well. ____________________________________________________________________________________ Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly