From: | Pól Ua Laoínecháin <linehanp(at)tcd(dot)ie> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Cc: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, pgsql-novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Why oh why is this join not working? |
Date: | 2019-11-18 11:39:12 |
Message-ID: | CAF4RT5Qqi6LPvHzK-_ZO78awguVJ5ux3FTqC_Z6T-A6LocN4Ug@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi Laurenz, and thanks for your contribution,
> > ERROR: column t1.englmark does not exist LINE 19: AND t1.englmark = t2.maxmark
> You cannot refer to a column alias in a WHERE condition,
> because grouping takes place *after* the WHERE condition
> has been evaluated.
Yes - of course! And nor can I refer to an aggregate! Thanks for
pointing out what I should have known at this stage! I'm putting it
down to late-night fatigue yesterday.
I'm just wondering if there are significant performance implications
associated with deeper levels of nesting?
I was attempting to look at using Window/Analytic functions to get
this done, but I just can't see it. I think that your solution (and
explanation) is optimal for this particular use case - a PIVOT (pity
it's not available by default in PostgreSQL!) is essential and there's
no (what I see as) a more elegant way.
Thanks again for your input,
Regards,
Pól...
> Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Vianello, Dan A | 2019-11-18 15:56:33 | RE: Why oh why is this join not working? |
Previous Message | Laurenz Albe | 2019-11-18 09:38:04 | Re: Why oh why is this join not working? |