Received: from inlaw.improtech.co.za (inlaw.improtech.co.za [196.25.85.67]) by hub.org (8.8.8/8.7.5) with SMTP id LAA27306 for ; Tue, 16 Jun 1998 11:17:23 -0400 (EDT) Received: by inlaw.improtech.co.za (Smail3.1.29.1 #3) id m0ylxUh-0012EcC; Tue, 16 Jun 98 17:17 SAT Message-Id: From: calvin@improtech.co.za (Calvin Browne) Subject: Beginner Join question To: pgsql-sql@postgresql.org Date: Tue, 16 Jun 1998 17:17:54 +0200 (SAT) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Been out of DB programming for a while, and am trying to get back in with postgres under Linux. Anyway, my question (should be fairly simple, but the manuals arn't quite clear) is as follows: TABLE A ( TABLE B( record_id record_id field1 field3 field2) field4) record_id in both tables are the same. The record definitely exists in TABLE A, but not necessarily in TABLE B. I need to get the following: record_id | A.field1 | A.field2 | B.field3 ------------------------------------------------------------------- rec1 | xxxx | xxxxxx | Field displayed if there is | | | a record in B, such that A.record_id | | | is equal to B.record.id, otherwise | | | leave it blank. ------------------------------------------------------------------- I'm going to have about a million records in each table, so efficiency of the join is a priority. Disk space is not. Thanks in advance. --Calvin -------------------| My opinions are mine |--------------------------------- Calvin Browne webmaster@improtech.co.za calvin@uniforum.org.za || Linux, NT, calvin@orange-tree.alt.za http://www.uniforum.org.za/~calvin |-|| Jeans, Page me via: http://www.uniforum.org.za/~calvin/page.html |--|| Sneakers & Phone: +27 11 805-1000 Fax: +27 11 805-4004 |------|| Talking Heads -------------| Gotta get this .sig shorter :) |-----------------------------