Search Postgresql Archives

Re: Subselect with no records results in final empty set

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

 



On Thu, Jan 29, 2015 at 1:22 PM, Sterpu Victor <victor@xxxxxxxx> 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.​



[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