Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 5C3BB9FBA68 for ; Mon, 14 May 2007 12:09:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 85007-06 for ; Mon, 14 May 2007 12:09:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.ringways.co.uk (unknown [80.193.83.131]) by postgresql.org (Postfix) with ESMTP id 188BF9FBAA2 for ; Mon, 14 May 2007 12:09:25 -0300 (ADT) Received: from eddie.ringways.co.uk ([10.1.1.115]) by mail.ringways.co.uk with esmtp (Exim 4.62) (envelope-from ) id 1Hnc5D-0000Pn-T8 for pgsql-sql@postgresql.org; Mon, 14 May 2007 16:03:32 +0100 From: Gary Stainburn Organization: Ringways Garages Ltd To: pgsql-sql@postgresql.org Subject: select ..... not in ..... Date: Mon, 14 May 2007 16:07:24 +0100 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200705141607.25712.gary.stainburn@ringways.co.uk> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/103 X-Sequence-Number: 28383 I folks. I'm struggling with a select which should be easy. select v_d_code, v_o_number, v_vin, v_status from vista_details where v_d_code='64340' and v_o_number='C0023'; v_d_code | v_o_number | v_vin | v_status ----------+------------+-------------+------------- 64340 | C0023 | GCDW7D37645 | COMPOUND IN (1 row) shows that the record exists in vista. select w_vin from walon where substring(w_vin from '(.{11}$)') = 'GCDW7D37645'; w_vin ------- (0 rows) shows that it doesn't exist in walon. So, who does this select not return the row? select v_d_code, v_o_number, v_vin, v_status from vista_details where v_vin not in ( goole(# select substring(w_vin from '(.{11}$)') from walon); v_d_code | v_o_number | v_vin | v_status ----------+------------+-------+---------- (0 rows) -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000