pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: oheinz@stud.fbi.fh-darmstadt.de
To: pgsql-sql@postgresql.org
Subject: Problem using Subselect results
Date: Wed, 23 Jul 2003 14:51:48 +0200
Message-ID: <1058964708.3f1e84e407a8d@stud.fbi.fh-darmstadt.de> (raw)

I want to use the result of a subselect as condition of another one.

CREATE VIEW my_view AS SELECT b,c
(SELECT a, b FROM table2 WHERE b=1) my_ab,
(SELECT  c FROM table3, my_ab WHERE table3.a=my_ab.a) my_c;

does return "relation my_ab unknown". it is not just a problem of execution 
order - if i turn it the other way round it's still the same.

Am I just trying to do something really stupid? And what for is the (necessary) 
AS statement for subselects, if it's not possible to access their results by 
that name?
As I need the result of a subselect  in several other subselects it's not 
possible to transform them into a cascade of sub, subsub, subsubsub.... selects.
Any ideas? 

TIA,
Oliver 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/



view thread (15+ messages)  latest in thread

Message-ID: <1058964708.3f1e84e407a8d@stud.fbi.fh-darmstadt.de>
Permalink:  ../1058964708.3f1e84e407a8d@stud.fbi.fh-darmstadt.de/
Also on:    postgresql.org/message-id/1058964708.3f1e84e407a8d@stud.fbi.fh-darmstadt.de

 · 

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: oheinz@stud.fbi.fh-darmstadt.de
  Subject: Re: Problem using Subselect results
  In-Reply-To: <1058964708.3f1e84e407a8d@stud.fbi.fh-darmstadt.de>

* 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