Обсуждение: Re: Réf. : Re: [SQL] Left outer join

Поиск
Список
Период
Сортировка

Re: Réf. : Re: [SQL] Left outer join

От
Richard Huxton
Дата:
On Thursday 23 October 2003 14:39, ext-thierry.templier@ccf.com wrote:
> Hello,
>
> It doesn't work...

You don't say how. By the way, please try to reply to the list as well as
directly to the person.

> Have you examples on left outer join on a table that is
> a part of a table? THanks,

richardh=# select * from ta;
 a |  b
---+-----
 1 | aaa
 2 | bbb
 3 | ccc
(3 rows)

richardh=# select * from tb;
 c |  d
---+-----
 1 | fff
 3 | ggg
(2 rows)

richardh=# SELECT a,b,c,d FROM (SELECT a,b FROM ta) AS one LEFT JOIN (SELECT
c,d FROM tb) AS two ON a=c;
 a |  b  | c |  d
---+-----+---+-----
 1 | aaa | 1 | fff
 2 | bbb |   |
 3 | ccc | 3 | ggg
(3 rows)

--
  Richard Huxton
  Archonet Ltd