Returning null for joined tables when one column non existant

Поиск
Список
Период
Сортировка
От Madison Kelly
Тема Returning null for joined tables when one column non existant
Дата
Msg-id 49A6DFC3.4060309@alteeve.com
обсуждение исходный текст
Ответы Re: Returning null for joined tables when one column non existant  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список pgsql-general
Hi all,

   I've got a query that crosses a few tables. For example:

SELECT
      a.foo, b.bar, c.baz
FROM
      aaa a, bbb b, ccc c
WHERE
      a.a_id=b.b_a_id AND a.a_id=c.c_a_id AND a.a_id=1;

   Obviously, if there is no match in 'bbb' or 'ccc' then nothing will
be returned, even if there is a match in one or both of the other
tables. Is there a way to say something like 'b.bar OR NULL' to make
sure that the matching columns with data still show and ones without a
match return NULL (or some string)?

Thanks!

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

Предыдущее
От: Maxim Boguk
Дата:
Сообщение: Re: Postgresql selecting strange index for simple query
Следующее
От: Andrew Gould
Дата:
Сообщение: Re: Off Topic: ICD-10 codes in a database table?