Re: Help with subselect (first time)

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Rodolfo J(dot) Paiz" <rpaiz(at)simpaticus(dot)com>
Cc: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Help with subselect (first time)
Date: 2005-02-05 16:00:48
Message-ID: 20050205160048.GA32184@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, Feb 04, 2005 at 21:40:29 -0600,
"Rodolfo J. Paiz" <rpaiz(at)simpaticus(dot)com> wrote:
>
> The two "tables" shown above are result sets to which I have a handle.
> It is my understanding that I can treat them as tables (albeit temporary
> ones) until they are released. Is that understanding incorrect?

Elements of a from item list can be selects. You just put the select query
inside parenthesis and use an AS clause to give an alias.
Something like:
SELECT tb.a FROM (SELECT a FROM ta) AS tb;

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Sean Davis 2005-02-05 16:12:09 Converting value to array
Previous Message Jorge Pérez 2005-02-05 04:01:55 OLE DB