Re: Why oh why is this join not working? - Mailing list pgsql-novice

From Pól Ua Laoínecháin
Subject Re: Why oh why is this join not working?
Date
Msg-id CAF4RT5Qqi6LPvHzK-_ZO78awguVJ5ux3FTqC_Z6T-A6LocN4Ug@mail.gmail.com
Whole thread Raw
In response to Re: Why oh why is this join not working?  (Laurenz Albe <laurenz.albe@cybertec.at>)
List 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



pgsql-novice by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Why oh why is this join not working?
Next
From: "Vianello, Dan A"
Date:
Subject: RE: Why oh why is this join not working?