X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 81BB8D1C951 for ; Thu, 24 Jul 2003 08:39:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 21198-04 for ; Thu, 24 Jul 2003 05:38:46 -0300 (ADT) Received: from stud.fbi.fh-darmstadt.de (stud.fbi.fh-darmstadt.de [141.100.40.65]) by svr1.postgresql.org (Postfix) with ESMTP id A94B2D1C94E for ; Thu, 24 Jul 2003 05:39:27 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by stud.fbi.fh-darmstadt.de (Postfix) with ESMTP id AE375CE65F for ; Thu, 24 Jul 2003 10:39:25 +0200 (CEST) Received: by stud.fbi.fh-darmstadt.de (Postfix, from userid 33) id D3E33CE65F; Thu, 24 Jul 2003 10:39:22 +0200 (CEST) Received: from troubadix.lhsystems.com (troubadix.lhsystems.com [193.24.32.38]) by stud.fbi.fh-darmstadt.de (IMP) with HTTP for ; Thu, 24 Jul 2003 10:39:22 +0200 Message-ID: <1059035962.3f1f9b3a609a0@stud.fbi.fh-darmstadt.de> Date: Thu, 24 Jul 2003 10:39:22 +0200 From: oheinz@stud.fbi.fh-darmstadt.de To: pgsql-sql@postgresql.org Subject: Problem using Subselect results MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.1 X-Originating-IP: 193.24.32.38 X-Scanned-By: AMaViS-ng at stud.fbi.fh-darmstadt.de. X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/357 X-Sequence-Number: 14471 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/