Re: Syntax question

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: Syntax question
Дата
Msg-id 20060526164126.GA12547@webserv.wug-glas.de
обсуждение исходный текст
Ответ на Syntax question  (John Taylor <d_low22003@yahoo.com>)
Список pgsql-general
am  26.05.2006, um  9:09:25 -0700 mailte John Taylor folgendes:
> I have a select statement that goes as follows:
>
>  SELECT * FROM product prod, prod_alias pa, category cat, company co
>  WHERE prod.catid = cat.catid
>  AND prod.coid = co.coid
>  AND prod.prodid = pa.prodid;
>
>  If possible, I want to change the statement so that I get output
>  regardless of whether there's a match between prod.prodid and
>  pa.prodid. IOW, if there's a match between prod.prodid and pa.prodid,
>  I want the output from both the product table and the prod_alias
>  table.  if there's no match, I still want the output from product
>  table. Can I do this in one select statement?

I think, you should read about 'left outer join'.
http://www.postgresql.org/docs/8.1/interactive/queries-table-expressions.html#QUERIES-FROM


HTH, Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Syntax question
Следующее
От: David Fetter
Дата:
Сообщение: Re: Syntax question