X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 27CF8D1EBB0 for ; Fri, 26 Mar 2004 14:50:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 22258-01 for ; Fri, 26 Mar 2004 10:50:15 -0400 (AST) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1FDAFD1ED5E for ; Fri, 26 Mar 2004 10:50:12 -0400 (AST) Received: from [134.22.71.76] (dyn-71-76.tor.dsl.tht.net [134.22.71.76]) by tht.net (Postfix) with ESMTP id 5D60B76B0D; Fri, 26 Mar 2004 09:49:23 -0500 (EST) Subject: Re: Newbie Query question From: Rod Taylor To: Marcel Loose Cc: pgsql-sql@postgresql.org In-Reply-To: References: Content-Type: text/plain Message-Id: <1080312551.338.25.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Fri, 26 Mar 2004 09:49:12 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/249 X-Sequence-Number: 17348 > However, this query does not give me the result I expected. It appears that > the database engine first calculates the cartesian product of the tables A > and B and then evaluates the query. Hence, I get multiple matches for Yup.. WHERE filters the results of the join. > Is there any way to do this, other than using UNION?? This is what you want. I think you could come out with what you want in other ways, but this is by far the most appropriate.