Re: JOINS...
От | Oliver Elphick |
---|---|
Тема | Re: JOINS... |
Дата | |
Msg-id | 1052821548.18710.53.camel@linda.lfix.co.uk обсуждение исходный текст |
Ответ на | Re: JOINS... (Dani Oderbolz <oderbolz@ecologic.de>) |
Список | pgsql-novice |
On Tue, 2003-05-13 at 08:01, Dani Oderbolz wrote: > Thats where the OUTER JOIN comes in - but this is - as far as i know- > not directly supported in Postgres. > You have to do this: > > Select product.name, color.name > from > product, > color > where product.color_id = color.color_id > UNION > Select product.name, 'No color' > from > product > where > color_id IS NULL; This advice is out of date. PostgreSQL does indeed support outer joins (since 7.1, I think). SELECT product.name, COALESCE(color.name,'No color') FROM product LEFT OUTER JOIN color ON product.color_id = color.color_id; -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Watch ye and pray, lest ye enter into temptation. The spirit truly is ready, but the flesh is weak." Mark 14:38
В списке pgsql-novice по дате отправления: