subquery with more than one column

From: Raimon Fernandez <coder(at)montx(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: subquery with more than one column
Date: 2007-07-05 18:34:25
Message-ID: 6506B613-A727-4BA1-BC59-6B48E5666A7D@montx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

It's not possible to return in a subquery more than one column ?

SELECT id_intern, (SELECT referencia, descripcio FROM articles WHERE
id_intern = product_blister.id_product_added) FROM product_blister
WHERE id_product_source = '8';

so, I would have to add a new subquery for each column I want to
retrieve ?

like this:

SELECT id_intern, (SELECT referencia FROM articles WHERE id_intern =
product_blister.id_product_added),(SELECT descripcio FROM articles
WHERE id_intern = product_blister.id_product_added) FROM
product_blister WHERE id_product_source = '8';

all of them are from the same table ...

regards,

raimon fernandez

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2007-07-05 19:30:33 Re: subquery with more than one column
Previous Message Josh Tolley 2007-07-05 14:35:14 Re: Update with aggregate subquery?