Re: How to join from two tables at once? - Mailing list pgsql-sql

From Joseph Shraibman
Subject Re: How to join from two tables at once?
Date
Msg-id 3F4E95B9.30204@selectacast.net
Whole thread Raw
In response to Re: How to join from two tables at once?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-sql
Stephan Szabo wrote:

> 
> Probably you want something like:
> SELECT u.uid, u.txt, p.val FROM
>  u INNER JOIN a ON (a.id=u.aid)
>  LEFT JOIN p ON (p.uid=u.uid AND p.pkey=a.pkey);
From the docs:
 A CROSS JOIN or INNER JOIN is a simple Cartesian product, the same as you get from 
listing the two items at the top level of FROM. CROSS JOIN is equivalent to INNER JOIN ON 
(TRUE), that is, no rows are removed by qualification. These join types are just a 
notational convenience, since they do nothing you couldn't do with plain FROM and WHERE.

... so obviously there *is* something that INNER JOIN can do that regular ANDs can't.  But 
I'm still not clear why one works and the other doesn't.



pgsql-sql by date:

Previous
From: Michael A Nachbaur
Date:
Subject: Forcing a trigger to run
Next
From: "Kumar"
Date:
Subject: Migrating Stored Procedures from MS SQL Server