Re: Can I unite 2 selects? - Mailing list pgsql-general

From Sterpu Victor
Subject Re: Can I unite 2 selects?
Date
Msg-id em4c3a1e80-37e9-498c-8275-64f0f4849c2e@victor-pc
Whole thread Raw
In response to Re: Can I unite 2 selects?  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
Thank you.
This is the syntax I was looking for.

------ Original Message ------
From: "Adrian Klaver" <adrian.klaver@aklaver.com>
To: "Sterpu Victor" <victor@caido.ro>; "PostgreSQL General"
<pgsql-general@postgresql.org>
Sent: 1/29/2015 9:09:31 PM
Subject: Re: [GENERAL] Can I unite 2 selects?

On 01/29/2015 10:58 AM, Sterpu Victor wrote:
Hello
Can I write a query where I receive a single result set from many
queries?
Something like this: SELECT (SELECT 1 AS t1, 2 AS t2), (SELECT 3 AS t3)
I tried exactly this but the error is: "ERROR: subquery must return
only one column"
But I don't see why it must have only one column.

postgres@test=# SELECT * from (SELECT 1 AS t1, 2 AS t2) as t, (SELECT 3
AS t3) as s;
t1 | t2 | t3
----+----+----
1 | 2 | 3


Thank you



-- Adrian Klaver
adrian.klaver@aklaver.com


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



pgsql-general by date:

Previous
From: "Sterpu Victor"
Date:
Subject: Subselect with no records results in final empty set
Next
From: David G Johnston
Date:
Subject: Re: Subselect with no records results in final empty set