Subqueries returning more than one value?

From: Adam Witney <awitney(at)sghms(dot)ac(dot)uk>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Subqueries returning more than one value?
Date: 2004-05-11 00:09:34
Message-ID: BCC5D84E.32817%awitney@sghms.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message CoL 2004-05-11 01:43:29 Re: Subqueries returning more than one value?
Previous Message Jeff Kowalczyk 2004-05-10 22:13:44 update table where rows are selected by inner join?