Search Postgresql Archives

Re: Can I unite 2 selects?

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

 



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@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[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