Re: referencing column aliases in select list - Mailing list pgsql-general

From Seb
Subject Re: referencing column aliases in select list
Date
Msg-id 87zlsaxm13.fsf@patagonia.sebmags.homelinux.org
Whole thread Raw
In response to referencing column aliases in select list  (Seb <spluque@gmail.com>)
List pgsql-general
On Fri, 04 Apr 2008 00:35:01 -0400,
Colin Wetherbee <cww@denterprises.org> wrote:

[...]

> SELECT foo - bar AS baz FROM ( SELECT a.a + b.a AS foo, a.b + b.b AS
> bar FROM a JOIN b ON a.id = b.id ) AS subtable;

> Although, I'm not really sure that's The Right Way to do it.

Thanks Colin, yes, I thought about that, but things get nasty when you
have to do some other calculation with 'baz', with the output of that
and so on (as I'm facing in my real tables).  But this may really be the
best solution anyway.


Cheers,

--
Seb

pgsql-general by date:

Previous
From: Colin Wetherbee
Date:
Subject: Re: referencing column aliases in select list
Next
From: Greg Smith
Date:
Subject: Re: simple update queries take a long time - postgres 8.3.1