date question
date question
От:
Judith Altamirano Figueroa <jaltamirano@correolux.com.mx>
Дата:
Hi everybody, in Postgres 7.0.2 I have the next query:
SELECT * from clientes_proceso where fecha_mod::date <= now() -1;
but in version 8.0.1 returns the next error:
ERROR: The operator doesn't exist: timestamp with time zone - integer
How can drop a day to now()??
Re: date question
От:
lucas@presserv.org
Дата:
Quoting Judith Altamirano Figueroa : > Hi everybody, in Postgres 7.0.2 I have the next query: > SELECT * from clientes_proceso where fecha_mod::date <= now() -1; > but in version 8.0.1 returns the next error: > ERROR: The operator doesn't exist: timestamp with time zone - integer > How can drop a day to now()?? Try using "now()::date", or "interval". Like: select * from clientes_proceso where fecha_mod::date <= now()::date -1; or: select * from clientes_proceso where fecha_mod::date <= now() - '1 day'::interval; --- Lucas
Re: date question
От:
Michael Glaesemann <grzm@myrealbox.com>
Дата:
On Nov 4, 2005, at 1:17 , Judith Altamirano Figueroa wrote: > Hi everybody, in Postgres 7.0.2 I have the next query: > > SELECT * from clientes_proceso where fecha_mod::date <= now() -1; > > but in version 8.0.1 returns the next error: > > ERROR: The operator doesn't exist: timestamp with time zone - integer > > How can drop a day to now()?? You can try a couple of different things: one is to use CURRENT_DATE - 1 instead of now() -1. Another would be to cast now() to date, e.g., now()::date - 1. Hope this helps. Michael Glaesemann grzm myrealbox com