Search Postgresql Archives

Returning null for joined tables when one column non existant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux