pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Francesc Leveque <webmaster@loroadictos.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Subselect returning 2 columns
Date: Thu, 06 May 2004 21:26:33 -0400
Message-ID: <26990.1083893193@sss.pgh.pa.us> (raw)
In-Reply-To: <4099FCB4.1090300@loroadictos.com>
References: <4099FCB4.1090300@loroadictos.com>

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



view thread (2+ messages)

Message-ID: <26990.1083893193@sss.pgh.pa.us>
Permalink:  ../26990.1083893193@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26990.1083893193@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, webmaster@loroadictos.com
  Subject: Re: Subselect returning 2 columns
  In-Reply-To: <26990.1083893193@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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