Subselect with no records results in final empty set

From: "Sterpu Victor" <victor(at)caido(dot)ro>
To: "PostgreSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: Subselect with no records results in final empty set
Date: 2015-01-29 19:54:01
Message-ID: emc7bb6066-5c47-4c1b-bb14-6368b21499f7@victor-pc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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;

Thank you.

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sterpu Victor 2015-01-29 19:55:42 Re: Can I unite 2 selects?
Previous Message Bill Moran 2015-01-29 19:24:50 Re: 4B row limit for CLOB tables