Re: How to join from two tables at once?

Поиск
Список
Период
Сортировка
От Joseph Shraibman
Тема Re: How to join from two tables at once?
Дата
Msg-id 3F4E95B9.30204@selectacast.net
обсуждение исходный текст
Ответ на Re: How to join from two tables at once?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список 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 по дате отправления:

Предыдущее
От: Michael A Nachbaur
Дата:
Сообщение: Forcing a trigger to run
Следующее
От: "Kumar"
Дата:
Сообщение: Migrating Stored Procedures from MS SQL Server