From: | Scara Maccai <m_lists(at)yahoo(dot)it> |
---|---|
To: | pgsql-general(at)postgresql(dot)org, Sam Mason <sam(at)samason(dot)me(dot)uk> |
Subject: | Re: referring to calculated column in sub select |
Date: | 2009-05-19 07:04:28 |
Message-ID: | 805279.17244.qm@web24613.mail.ird.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Using Mysql the query works, so I expected it to be somehow "standard" (I know, Mysql sometimes allows much more than the standard...)
Does this has something to do with Support LATERAL subqueries" in the to do list?
It's a very shame it's not supported...
Thank you
--- Lun 18/5/09, Sam Mason <sam(at)samason(dot)me(dot)uk> ha scritto:
> Da: Sam Mason <sam(at)samason(dot)me(dot)uk>
> Oggetto: Re: [GENERAL] referring to calculated column in sub select
> A: pgsql-general(at)postgresql(dot)org
> Data: Lunedì 18 maggio 2009, 19:10
> On Mon, May 18, 2009 at 06:49:30AM
> -0700, Scara Maccai wrote:
> > why column "acoltest" is not found by the subselect in
> this select:
>
> The "acoltest" identifier is only visible from outside the
> query, not
> within its defining query or any of its sub-queries.
> If you're trying
> to solve a problem like the example, it would probably be
> easiest to
> swap the inner and outer queries around, i.e. something
> like:
>
> SELECT acoltest, MAX(b.t)
> FROM (
> SELECT acol + 100 as acoltest
> FROM mytab2
> GROUP BY 1) a LEFT JOIN mytab b ON a.acoltest
> = b.anothercol
> GROUP BY acoltest;
>
> --
> Sam http://samason.me.uk/
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Albe Laurenz | 2009-05-19 07:09:18 | Re: Commit visibility guarantees |
Previous Message | Pavel Stehule | 2009-05-19 05:28:31 | Re: array/function question |