Subselect returning 2 columns

From: Francesc Leveque <webmaster(at)loroadictos(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Subselect returning 2 columns
Date: 2004-05-06 08:52:04
Message-ID: 4099FCB4.1090300@loroadictos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

Is correct to do something like?:

SELECT row1,row2 FROM mytable
WHERE (row1,row3) IN
(SELECT row1 as p1,MAX(row3) as p2 FROM mytable
WHERE row3 <= current_date
GROUP BY row1)

I mean, I don't see documentation about subselects returning more than
one column, but it seems to work...

Thanks,
Francesc.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Theodore Petrosky 2004-05-06 11:46:22 Re: not really SQL but I need info on BLOBs
Previous Message Andrei Bintintan 2004-05-06 05:27:20 Re: not really SQL but I need info on BLOBs