Re: Subselect with no records results in final empty set

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: Subselect with no records results in final empty set
Дата
Msg-id 1422561818538-5836014.post@n5.nabble.com
обсуждение исходный текст
Ответ на Subselect with no records results in final empty set  ("Sterpu Victor" <victor@caido.ro>)
Ответы Re: Subselect with no records results in final empty set  ("Sterpu Victor" <victor@caido.ro>)
Список pgsql-general
Sterpu Victor wrote
> Hello
>
> I have this select where the last subselect will return a empty set and
> because of this the whole select will be empty.
> How can I change this syntax so I will have a row result even if the
> last select is empty?
>
> SELECT * FROM (SELECT 1 AS t1, 2 AS t2) as t, (SELECT 3 AS t3) as s,
> (SELECT * FROM atc WHERE id = '1231222' LIMIT 1 OFFSET 0) AS s3;

Use explicit join syntax; and then pick the "LEFT [OUTER] JOIN" variant.

SELECT
FROM t
LEFT JOIN s3 ON (TRUE)

David J.



--
View this message in context:
http://postgresql.nabble.com/Subselect-with-no-records-results-in-final-empty-set-tp5836011p5836014.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: "Sterpu Victor"
Дата:
Сообщение: Re: Can I unite 2 selects?
Следующее
От: Steve Boyle
Дата:
Сообщение: trouble adding a node to BDR