Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id JAA45595 for ; Wed, 18 Aug 1999 09:52:45 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id JAA24556; Wed, 18 Aug 1999 09:51:30 -0400 (EDT) To: Bruce Momjian cc: Hamid Khoshnevis , pgsql-sql@postgreSQL.org Subject: Re: [SQL] Using intersect in subquery In-reply-to: Your message of Tue, 17 Aug 1999 22:38:13 -0400 (EDT) <199908180238.WAA12634@candle.pha.pa.us> Date: Wed, 18 Aug 1999 09:51:29 -0400 Message-ID: <24554.934984289@sss.pgh.pa.us> From: Tom Lane Bruce Momjian writes: > Try 6.5. We fixed some Intersect stuff. >> >> select * from Table1 >> where KeyField1 in >> (select KeyField2 from Table2 where somecondition >> intersect >> select KeyField3 from Table3 where somecondition); >> >> (I believe) I am running PG 6.4. The INTERSECT by itself works, but not in >> a subquery. >> No, it still won't work --- the current grammar specifies SubSelect not select_clause as the kind of select you can put inside an expression. Not sure what it would take to fix this; I have a feeling that just changing the grammar wouldn't be good enough :-(. Better add it to the TODO list: * Support UNION/INTERSECT/EXCEPT in sub-selects regards, tom lane