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

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to