Re: referencing column aliases in select list

From: Seb <spluque(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: referencing column aliases in select list
Date: 2008-04-04 04:48:56
Message-ID: 87zlsaxm13.fsf@patagonia.sebmags.homelinux.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 04 Apr 2008 00:35:01 -0400,
Colin Wetherbee <cww(at)denterprises(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2008-04-04 05:02:13 Re: simple update queries take a long time - postgres 8.3.1
Previous Message Colin Wetherbee 2008-04-04 04:35:01 Re: referencing column aliases in select list