X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 13056D1D541 for ; Mon, 12 Jan 2004 04:06:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 72705-09 for ; Mon, 12 Jan 2004 00:06:07 -0400 (AST) Received: from srvr3.iniquinet.com (srvr2.iniquinet.com [64.240.87.12]) by svr1.postgresql.org (Postfix) with SMTP id 8BBD3D1B7E7 for ; Mon, 12 Jan 2004 00:06:06 -0400 (AST) Received: (qmail 14945 invoked by uid 104); 12 Jan 2004 03:58:31 -0000 Received: from Robert_Creager@LogicalChaos.org by srvr3.iniquinet.com by uid 101 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.55. Clear:SA:0(-6.9/6.0):. Processed in 38.993862 secs); 12 Jan 2004 03:58:31 -0000 Received: from vsat-148-64-8-86.c119.t7.mrt.starband.net (HELO chaos.mshome.net) (148.64.8.86) by srvr3.iniquinet.com with SMTP; 12 Jan 2004 03:57:51 -0000 Received: from localhost.localdomain (thunder.mshome.net [192.168.0.250]) by chaos.mshome.net (Postfix) with ESMTP id 7194B1E5049 for ; Sun, 11 Jan 2004 21:05:05 -0700 (MST) Received: from logicalchaos.org (thunder.mshome.net [192.168.0.250]) by chaos.mshome.net (Postfix) with SMTP id 67105107B2B for ; Sun, 11 Jan 2004 21:05:00 -0700 (MST) Date: Sun, 11 Jan 2004 21:04:54 -0700 From: Robert Creager To: PGSQL Subject: Problem with NOT IN portion of query. Message-Id: <20040111210454.4ee900ae.Robert_Creager@LogicalChaos.org> Organization: Starlight Vision, LLC. X-Mailer: Sylpheed version 0.9.5claws (GTK+ 1.2.10; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="Multipart_Sun__11_Jan_2004_21_04_54_-0700_=.IJsd2ivWEfDDPk" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/87 X-Sequence-Number: 16480 --Multipart_Sun__11_Jan_2004_21_04_54_-0700_=.IJsd2ivWEfDDPk Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 7bit Hey All, Probably doing something stupid, and I'm too tired to see what. The query I'm trying to execute is: SELECT date_trunc( 'hour', "when" )::timestamp AS period FROM readings WHERE period NOT IN (SELECT "time" FROM hour.summary_period) GROUP BY period ORDER BY period; Where the table definitions are: CREATE TABLE readings ( "when" TIMESTAMP DEFAULT now() NOT NULL PRIMARY KEY ); CREATE SCHEMA hour; CREATE TABLE hour.summary_period ( "time" TIMESTAMP NOT NULL ); The error is: ERROR: column "period" does not exist When I remove the NOT IN (and associated WHERE), the query works fine. Any help? Cheers, Rob -- 20:55:35 up 14 days, 10:45, 4 users, load average: 2.01, 2.04, 2.05 --Multipart_Sun__11_Jan_2004_21_04_54_-0700_=.IJsd2ivWEfDDPk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iEYEARECAAYFAkACHOwACgkQLQ/DKuwDYzlKpgCbBYk3ZSRot461xlrxrj4hxHqw 0wAAnR5hL+Pif18vnGWGBjpJXndkp3eU =aend -----END PGP SIGNATURE----- --Multipart_Sun__11_Jan_2004_21_04_54_-0700_=.IJsd2ivWEfDDPk--