From: | David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Sterpu Victor <victor(at)caido(dot)ro> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Subselect with no records results in final empty set |
Date: | 2015-01-29 20:39:14 |
Message-ID: | CAKFQuwbVWgCCBwNsCGsYJvhWyEJbRmHxz9-e+OLbUEMuEC=vNQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Jan 29, 2015 at 1:22 PM, Sterpu Victor <victor(at)caido(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2015-01-29 20:52:25 | Re: Subselect with no records results in final empty set |
Previous Message | Sterpu Victor | 2015-01-29 20:36:07 | Re: Subselect with no records results in final empty set |