Received: from junk.nocrew.org ([212.73.17.42]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eAAICIs38733 for ; Fri, 10 Nov 2000 13:12:19 -0500 (EST) (envelope-from tomas@junk.nocrew.org) Received: from tomas by junk.nocrew.org with local (Exim 3.12 #1 (Debian)) id 13uIdf-00087g-00; Fri, 10 Nov 2000 19:10:59 +0100 To: Tom Lane Cc: Christophe Boyanique , pgsql-sql@postgresql.org Subject: Re: SELECT FROM t1 WHERE id IN (SELECT id FROM t2 UNION SELECT id FROM t3) References: <3A0C2193.DB793E1B@formanet.be> <11647.973874138@sss.pgh.pa.us> From: Tomas Berndtsson Date: 10 Nov 2000 19:10:58 +0100 In-Reply-To: Tom Lane's message of "Fri, 10 Nov 2000 11:35:38 -0500" Message-ID: <80vgtvhf4d.fsf@junk.nocrew.org> Lines: 21 User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200011/88 X-Sequence-Number: 119 Tom Lane writes: > Christophe Boyanique writes: > > SELECT idProduct FROM products > > WHERE idProduct IN > > (SELECT id FROM orders WHERE ts>'2000-10-01 17:04:00' > > UNION SELECT id FROM preorders WHERE ts>'2000-10-01 17:04:00') > > ORDER by name; > > > and I've got a parse error near UNION or SELECT depending of the > > Current releases don't handle UNION in sub-selects. 7.1 will. > > In the meantime, consider doing the UNION into a temp table and then > using that for the IN operator. Is it possible to create a view with UNION and use that in the sub-select? Tomas