Received: from orion.uk.insnet.net (orion.uk.insnet.net [194.177.174.244]) by hub.org (8.10.1/8.10.1) with ESMTP id e6CFWGW71951 for ; Wed, 12 Jul 2000 11:32:17 -0400 (EDT) Received: from stan.ringways.co.uk ([213.38.87.130]) by orion.uk.insnet.net (8.9.3/8.9.3) with ESMTP id QAA12999 for ; Wed, 12 Jul 2000 16:32:14 +0100 (BST) Received: from garys.ringways.co.uk ([10.1.1.2]) by stan.ringways.co.uk with smtp (Exim 3.13 #1) id 13COMi-0003A4-00 for pgsql-sql@postgresql.org; Wed, 12 Jul 2000 16:24:00 +0100 Received: by garys.ringways.co.uk with Microsoft Mail id <01BFEC1E.FF0A43A0@garys.ringways.co.uk>; Wed, 12 Jul 2000 16:34:06 +0100 Message-ID: <01BFEC1E.FF0A43A0@garys.ringways.co.uk> From: Gary Stainburn To: "'pgsql-sql@postgresql.org'" Subject: join if there, blank if not Date: Wed, 12 Jul 2000 16:34:04 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Archive-Number: 200007/128 Hi all, I just can't get my head round this one so I hope one of you can. I've got two tables, one holding phone calls, and another holding phone numbers. I want to do a select where if the number in the calls table exists in the numbers table, the description is included otherwise the description field is blank. Unfortunately, using the select I've tried, if the number is not on the one of the tables, it's ignored. Calls table cdate date ctime time cextn char(3) cnumber x(12) Numbers table nnumber x(12) ndesc x(30) Select I tried. select c.cdate, c.ctime, c.cextn, c.cnumber n.ndesc from calls c, numbers n where c.cnumber = n.nnumber; ----------------------------------------- Gary Stainburn. Work: http://www.ringways.co.uk mailto:gary.stainburn@ringways.co.uk REVCOM: http://www.revcom.org.uk mailto:gary.stainburn@revcom.org.uk ----------------------------------------- Murphy's Laws: (327) The minute before the engineer arrives, the printer starts working. -----------------------------------------