Problem with NOT IN portion of query.

Поиск
Список
Период
Сортировка
От Robert Creager
Тема Problem with NOT IN portion of query.
Дата
Msg-id 20040111210454.4ee900ae.Robert_Creager@LogicalChaos.org
обсуждение исходный текст
Ответы Re: Problem with NOT IN portion of query.
Список pgsql-sql
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

В списке pgsql-sql по дате отправления:

Предыдущее
От: azwa@nc.com.my
Дата:
Сообщение: Re: Missing data for column
Следующее
От: katarn
Дата:
Сообщение: Unique key field or serverl fks ?