From: Thomas Lockhart <lockhart@alumni.caltech.edu>
To: Oliver Elphick <olly@lfix.co.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: JOIN syntax
Date: Mon, 26 Jun 2000 04:11:26 +0000
Message-ID: <3956D7EE.3519A134@alumni.caltech.edu> (raw)
References: <200006252305.e5PN5we16803@linda.lfix.co.uk>
> Looking at SQL92, it seems that I ought to be able to do this:
> SELECT * FROM invoice INNER JOIN
> (SELECT * FROM invoice_line WHERE lineno > 1)
> ON invoice.invno = invoice_line.invno;
> ERROR: parser: parse error at or near "("
Wrong syntax (for Postgres anyway). We don't yet have subselects in the
syntax. Thanks for the example though; it seems like some variant should
be allowed, though perhaps not as written above.
Something like
select * from invoice inner join
(select * from invoice_line where lineno > 1)
as IL (invno, yada)
on invoice.invno = IL.invno;
seems like it could be legal. Your variant of this may have trouble
hooking up invoice_line.invno after the subselect, since the subselect
result may lose the linkage with the underlying input table.
But, all this is theoretical, since Postgres doesn't yet do the right
thing at all.
- Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: lockhart@alumni.caltech.edu, olly@lfix.co.uk
Subject: Re: JOIN syntax
In-Reply-To: <3956D7EE.3519A134@alumni.caltech.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox