Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 486FB4759DF for ; Fri, 23 Aug 2002 05:52:23 -0400 (EDT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by postgresql.org (Postfix) with ESMTP id C0009474E49 for ; Fri, 23 Aug 2002 05:52:22 -0400 (EDT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 17iB7A-0001iA-0U; Fri, 23 Aug 2002 10:52:24 +0100 Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id C2C2C1713D; Fri, 23 Aug 2002 10:24:57 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: yon@dugem.com, Tom Lane Subject: Re: SELECT ... WHERE ... NOT IN (SELECT ...); Date: Fri, 23 Aug 2002 10:24:28 +0100 User-Agent: KMail/1.4.1 Cc: pgsql-sql@postgresql.org References: <20020823082835.959193953@sitemail.everyone.net> In-Reply-To: <20020823082835.959193953@sitemail.everyone.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200208231024.28241.dev@archonet.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/322 X-Sequence-Number: 9168 On Friday 23 Aug 2002 9:28 am, Yon Den Baguse Ngarso wrote: > Oops correction. > > If i create tbl1 & tbl2, and then load it with the data. > The result is CORRECT. Like yours. > > But, if the data loaded from another table, the result become WRONG/ null > record. > > Here is my detail step. Please Help. > myhost=3D# --create new temp tbl1 > myhost=3D# SELECT losteventid AS eventid INTO tbl1 FROM outages; > myhost=3D# --create new temp tbl2 > myhost=3D# SELECT regainedeventid AS eventid INTO tbl2 FROM outages; These aren't creating temporary tables, they are creating permanent tables.= Do=20 you have data from previous runs in there? Try SELECT ... INTO TEMPORARY tbl1 ... - Richard Huxton