X-Original-To: pgsql-sql@postgresql.org Received: from esc.esc1.com (dpc6682143102.direcpc.com [66.82.143.102]) by postgresql.org (Postfix) with ESMTP id 73035475CE5 for ; Tue, 11 Mar 2003 12:49:27 -0500 (EST) Received: from esc1.com (IDENT:terry@localhost [127.0.0.1]) by esc.esc1.com (8.11.0/8.11.0) with ESMTP id h2BHlcU11275 for ; Tue, 11 Mar 2003 12:47:38 -0500 Message-ID: <3E6E2139.5060903@esc1.com> Date: Tue, 11 Mar 2003 12:47:37 -0500 From: Terry Lee Tucker Organization: Enhanced Solutions Computing User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Novice needs help Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/264 X-Sequence-Number: 12304 I have loaded over 29,000 customer records into a database. I'm trying to apply a referential foreign key that validates the country code and the province code in another table. It won't work because somewhere in that 29,000 records there is a province code or country code that doesn't match. Is there a way to use a select statement to find out which customer records has the invalid data? Here is the partial table layout: cust province -------- ------- country ===> country province ===> code Thanks in advance... -- Terry Lee Tucker