Re: What's wrong with this query?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mike Christensen <mike(at)kitchenpc(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: What's wrong with this query?
Date: 2010-09-22 14:28:41
Message-ID: 24836.1285165721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mike Christensen <mike(at)kitchenpc(dot)com> writes:
> So are you saying that a JOIN can only refer to itself and the last
> table on the FROM list?

Um, I think you've got the wrong mental model of the syntax. JOIN
is a binary operation between two tables:

tab1 JOIN tab2 ON some-condition-involving-tab1-and-tab2-only

You can nest these critters (ie, tab1 or tab2 could itself be a
JOIN construct), and you can write them as elements of a comma-separated
FROM list. But the ON condition can never refer to anything outside
its JOIN construct.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Atul.Goel 2010-09-22 16:26:29 Kill -9 for a session process caused all the sessions to be killed
Previous Message Lincoln Yeoh 2010-09-22 13:53:51 Re: How about synchronous notifications?