From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | "Darryl M(dot) Wolski" <drwolski(at)sympatico(dot)ca>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: nested inner join help |
Date: | 2002-01-14 21:30:36 |
Message-ID: | web-601184@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2002-01-14 21:31:32 | Re: Uisng Procedures via JDBC |
Previous Message | Josh Berkus | 2002-01-14 21:23:17 | Re: CREATE TABLE glitch -fix request for 7.2 |