Re: Subselect with no records results in final empty set

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Subselect with no records results in final empty set
Дата
Msg-id CAKFQuwbVWgCCBwNsCGsYJvhWyEJbRmHxz9-e+OLbUEMuEC=vNQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Subselect with no records results in final empty set  ("Sterpu Victor" <victor@caido.ro>)
Список pgsql-general
On Thu, Jan 29, 2015 at 1:22 PM, Sterpu Victor <victor@caido.ro> wrote:
It works as you sugested, this is the syntax I used:
SELECT * FROM
(SELECT 1 AS t1, 2 AS t2) AS t1
LEFT JOIN (SELECT * FROM atc WHERE id = '1231222') AS t2 ON (null)

Thank you.


You will notice that everyone responding to you is bottom-posting...
 
​Anyway, the use of "ON (null)" is unusual...

Also, the fact that your toy model is making considerable use of "CROSS JOIN" is unusual; one common reality of "relational databases" is that usually the things you are going together are "related" and the join conditions reflect those relationships.  I'd suggest using actual tables (or CTE/WITH) with multiple rows of data to try and learn how to write queries.  The number of times you are going to join together multiple results each only having a single row is slim.

David J.​


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

Предыдущее
От: "Sterpu Victor"
Дата:
Сообщение: Re: Subselect with no records results in final empty set
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Subselect with no records results in final empty set