Skip site navigation (1) Skip section navigation (2)

Re: JOIN syntax

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: JOIN syntax
Date: 2000-06-26 04:11:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
> Looking at SQL92, it seems that I ought to be able to do this:
>  (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

In response to

  • JOIN syntax at 2000-06-25 23:05:58 from Oliver Elphick

pgsql-sql by date

Next:From: Kyle BatemanDate: 2000-06-26 15:35:48
Subject: finding (and recycling) holes in sequences
Previous:From: Oliver ElphickDate: 2000-06-25 23:05:58
Subject: JOIN syntax

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group