pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ray Madigan <ray@madigans.org>
To: Pgsql-Sql <pgsql-sql@postgresql.org>
Subject: Select in From clause
Date: Fri, 9 Nov 2007 09:21:40 -0800
Message-ID: <IIEPJABILGOCODDLDNJFGENDCEAA.ray@madigans.org> (raw)

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.




view thread (3+ messages)  latest in thread

Message-ID: <IIEPJABILGOCODDLDNJFGENDCEAA.ray@madigans.org>
Permalink:  ../IIEPJABILGOCODDLDNJFGENDCEAA.ray@madigans.org/
Also on:    postgresql.org/message-id/IIEPJABILGOCODDLDNJFGENDCEAA.ray@madigans.org

 · 

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: ray@madigans.org
  Subject: Re: Select in From clause
  In-Reply-To: <IIEPJABILGOCODDLDNJFGENDCEAA.ray@madigans.org>

* 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