pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Darryl M. Wolski <drwolski@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: Re: nested inner join help
Date: Mon, 14 Jan 2002 13:30:36 -0800
Message-ID: <web-601184@davinci.ethosmedia.com> (raw)
In-Reply-To: <000801c1973d$75ea1980$ae00a8c0@arbour>

Darryl,

In Postgres, neither the parentheses nor the word "INNER" are required.  You
 will significantly simplify your life if you get rid of them, and clean up
 your presentation of SQL text in order to debug your own joins.

One significant MSAccess <==> Postgres conflict is that Postgres assumes that
 parens in the FROM clause represent subselects (I think), while MS Access uses
 parens to organize JOINs.  Postgres behavior is, of course, more SQL92
 correct.

SELECT orderlines.quantity, products.productname, products.productcost,
 customers.custlname,customers.custfname
FROM orders JOIN orderlines ON orders.orderid = orderlines.lnkorderid 
   JOIN customers ON customers.custid = orders.lnkcustid 
   JOIN products ON products.productid = orderlines.lnkproductid
WHERE orders.orderid=2;

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



view thread (5+ messages)  latest in thread

Message-ID: <web-601184@davinci.ethosmedia.com>
Permalink:  ../web-601184@davinci.ethosmedia.com/
Also on:    postgresql.org/message-id/web-601184@davinci.ethosmedia.com

 · 

reply

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: josh@agliodbs.com, drwolski@sympatico.ca
  Subject: Re: nested inner join help
  In-Reply-To: <web-601184@davinci.ethosmedia.com>

* 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