select with date_part and month failure....

Поиск
Список
Период
Сортировка
От P.MO
Тема select with date_part and month failure....
Дата
Msg-id 6.2.3.4.2.20060418091102.02943380@pop.libertysurf.fr
обсуждение исходный текст
Ответы Re: select with date_part and month failure....  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-general

Hello

I have the same problem against various PostgreSQL 8.1.3, 8.0.2 and 7.4.7:

I have a table containing periodical invoices. it contain's the last time the
invoce was printed and a period in month to be waited before next time.
My querry works with date_parts on days but never with months:

create temp table tstdates (
 lasttimedone date,
 period integer
);

insert into tstdates values ('2006-01-01',2);
insert into tstdates values ('2006-02-01',2);
insert into tstdates values ('2006-03-01',2);
insert into tstdates values ('2006-04-01',2);

-- doesn' t works :
select * from tstdates where
date_part('month',now()-lasttimedone) >= period;

--  works :
select * from tstdates where
date_part('days',now()-lasttimedone) >= period*30;


Can someone point me an error ?

T.I.A.    PM.



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

Предыдущее
От: Hannes Dorbath
Дата:
Сообщение: Re: tsearch partial word
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: select with date_part and month failure....