Select in From clause

From: "Ray Madigan" <ray(at)madigans(dot)org>
To: "Pgsql-Sql" <pgsql-sql(at)postgresql(dot)org>
Subject: Select in From clause
Date: 2007-11-09 17:21:40
Message-ID: IIEPJABILGOCODDLDNJFGENDCEAA.ray@madigans.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have never seen this done before, but it seems like it is supposed to work
from reading the manual.

I want to be able to get a table name from another table and use it in the
from clause of a select.

Something like

SELECT * FROM (SELECT name FROM bar WHERE conditions) AS b WHERE b.condition
= xxx;

which translates to something like

SELECT * FROM Dealer AS b WHERE b.zipcode = 12345;

The translated version works but the SELECT in FROM version reports that
b.condition does not exist.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2007-11-09 18:35:59 Re: Select in From clause
Previous Message Keith Carr 2007-11-09 14:01:02 Re: Temporal databases