| From: | oheinz(at)stud(dot)fbi(dot)fh-darmstadt(dot)de | 
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org | 
| Subject: | Problem using Subselect results | 
| Date: | 2003-07-24 08:39:22 | 
| Message-ID: | 1059035962.3f1f9b3a609a0@stud.fbi.fh-darmstadt.de | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
Hi all,
I want to use the result of a subselect as condition in another one.
table1: a,b
table2: a,c
CREATE VIEW my_view AS SELECT b,c
(SELECT a, b FROM table1 WHERE b=1) my_ab,
(SELECT  c FROM table2, my_ab WHERE table3.a=my_ab.a) my_c;
this is just an example - i know i could cross join this one, but i need to 
refer to the results of several subselects in several other.
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?
And 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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christoph Haller | 2003-07-24 12:11:15 | Re: Problem using Subselect results | 
| Previous Message | ext-thierry.templier | 2003-07-24 07:10:50 | Combine 'left outer join' and 'inner join' |