Re: nested inner join help - Mailing list pgsql-sql

From Josh Berkus
Subject Re: nested inner join help
Date
Msg-id web-601184@davinci.ethosmedia.com
Whole thread Raw
In response to nested inner join help  ("Darryl M. Wolski" <drwolski@sympatico.ca>)
Responses Re: nested inner join help  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Darryl,

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

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

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
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: CREATE TABLE glitch -fix request for 7.2
Next
From: pocm@rnl.ist.utl.pt (Paulo J. Matos)
Date:
Subject: On delete cascade!