pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSubqueries returning more than one value?
2+ messages / 2 participants
[nested] [flat]
* Subqueries returning more than one value?
@ 2004-05-11 00:09 Adam Witney <awitney@sghms.ac.uk>
0 siblings, 1 reply; 2+ messages in thread
From: Adam Witney @ 2004-05-11 00:09 UTC (permalink / raw)
To: pgsql-sql
Hi,
I am using a function in a subquery, this works ok:
SELECT name, (SELECT p_my_func(1)) AS id
FROM test;
However I would like to have the function return 2 values into the main
query... Something like this:
SELECT name, (SELECT p_my_func(1)) AS (id, type)
FROM test;
Of course this gives the error:
ERROR: subquery must return only one column
Is there any way around this?
Thanks for any help
adam
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Subqueries returning more than one value?
@ 2004-05-11 01:43 CoL <col@mportal.hu>
parent: Adam Witney <awitney@sghms.ac.uk>
0 siblings, 0 replies; 2+ messages in thread
From: CoL @ 2004-05-11 01:43 UTC (permalink / raw)
To: pgsql-sql
hi,
Adam Witney wrote, On 5/11/2004 02:09:
> Hi,
>
> I am using a function in a subquery, this works ok:
>
> SELECT name, (SELECT p_my_func(1)) AS id
> FROM test;
>
> However I would like to have the function return 2 values into the main
> query... Something like this:
>
> SELECT name, (SELECT p_my_func(1)) AS (id, type)
> FROM test;
>
> Of course this gives the error:
>
> ERROR: subquery must return only one column
>
> Is there any way around this?
SELECT name,t.* FROM (SELECT p_my_func(1)) AS t(id, type), test
C.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-05-11 01:43 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-11 00:09 Subqueries returning more than one value? Adam Witney <awitney@sghms.ac.uk>
2004-05-11 01:43 ` CoL <col@mportal.hu>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox