Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA1H2Nl76345 for ; Wed, 1 Nov 2000 12:02:23 -0500 (EST) (envelope-from josh@agliodbs.com) Received: from [206.169.43.130] (HELO agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.3) with ESMTP id 1114723 for pgsql-sql@postgresql.org; Wed, 01 Nov 2000 09:02:11 -0800 Message-ID: <3A004C68.C0F5758C@agliodbs.com> Date: Wed, 01 Nov 2000 09:01:28 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions X-Mailer: Mozilla 4.73 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: sqllist Subject: Re: Outer Joins References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/8 X-Sequence-Number: 39 Marc, > select a.col1, b.col2 from a,b > where a.col1 = b.col2 > or b.col2 is null The above would select each record in a that matched a record in b, plus each record in b for every possible a where b.col2 was null - not where there was no match. > select a.col1, b.col2 from a,b > where a.col1 = b.col2 > or a.col1 not in (select b.col2 from b) This would work, but it would be *much* slower than a UNION query. "Not In" queries are perhaps the slowest you can run; see the earlier thread "Query Problem" for a discussion. UNION queries are, in fact, very fast ... just awkward to code and manipulate. -Josh -- ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 436-9166 for law firms, small businesses fax 436-0137 and non-profit organizations. pager 338-4078 San Francisco