pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Creager <Robert_Creager@LogicalChaos.org>
To: PGSQL <pgsql-sql@postgresql.org>
Subject: Problem with NOT IN portion of query.
Date: Sun, 11 Jan 2004 21:04:54 -0700
Message-ID: <20040111210454.4ee900ae.Robert_Creager@LogicalChaos.org> (raw)


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

view thread (3+ messages)  latest in thread

Message-ID: <20040111210454.4ee900ae.Robert_Creager@LogicalChaos.org>
Permalink:  ../20040111210454.4ee900ae.Robert_Creager@LogicalChaos.org/
Also on:    postgresql.org/message-id/20040111210454.4ee900ae.Robert_Creager@LogicalChaos.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Robert_Creager@LogicalChaos.org
  Subject: Re: Problem with NOT IN portion of query.
  In-Reply-To: <20040111210454.4ee900ae.Robert_Creager@LogicalChaos.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox