From: Joseph Shraibman <jks@selectacast.net>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to join from two tables at once?
Date: Thu, 28 Aug 2003 19:52:25 -0400
Message-ID: <3F4E95B9.30204@selectacast.net> (raw)
In-Reply-To: <20030825201102.T11277-100000@megazone.bigpanda.com>
References: <20030825201102.T11277-100000@megazone.bigpanda.com>
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.
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: jks@selectacast.net, sszabo@megazone.bigpanda.com
Subject: Re: How to join from two tables at once?
In-Reply-To: <3F4E95B9.30204@selectacast.net>
* 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