Re: Subselect returning 2 columns - Mailing list pgsql-sql

From Tom Lane
Subject Re: Subselect returning 2 columns
Date
Msg-id 26990.1083893193@sss.pgh.pa.us
Whole thread Raw
In response to Subselect returning 2 columns  (Francesc Leveque <webmaster@loroadictos.com>)
List pgsql-sql
Francesc Leveque <webmaster@loroadictos.com> writes:
> 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)

Sure.

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

http://www.postgresql.org/docs/7.4/static/functions-subquery.html#AEN12497
        regards, tom lane


pgsql-sql by date:

Previous
From: Francesc Leveque
Date:
Subject: Subselect returning 2 columns
Next
From: "Martin Kuria"
Date:
Subject: Re: SUM() & GROUP BY