Re: Help with syntax for timestamp addition

Поиск
Список
Период
Сортировка
От Scott Nixon
Тема Re: Help with syntax for timestamp addition
Дата
Msg-id 1101137609.23458.16.camel@talon
обсуждение исходный текст
Ответ на Re: Help with syntax for timestamp addition  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-general
> Just to add to the record, the mathematically sound way to write this
> query would be this:
>
> SELECT number
> FROM procedures
> WHERE date + numdays * interval '1 day' <= current_timestamp;


Thanks for that Peter!  That's a lot closer than what I originally
had...I didn't think about doing that but it makes sense.


Is there any advantage/disadvantages to using this method or the other?




On Mon, 2004-11-22 at 10:26, Peter Eisentraut wrote:
> Ian Barwick wrote:
> > On Mon, 22 Nov 2004 15:12:26 +0100, Patrick Fiche
> >
> > <patrick.fiche@aqsacom.com> wrote:
> > > Have a try at this syntax
> > >
> > > SELECT number
> > > FROM procedures
> > > WHERE date + CAST( numdays || ' days' AS interval ) <=
> > > CURRENT_TIMESTAMP;
> >
> > Just for the record you could write it like this too:
> >  SELECT number
> >  FROM procedures
> >  WHERE date + (numdays || ' days')::interval  <= CURRENT_TIMESTAMP;
>
> Just to add to the record, the mathematically sound way to write this
> query would be this:
>
> SELECT number
> FROM procedures
> WHERE date + numdays * interval '1 day' <= current_timestamp;
>
> --
> Peter Eisentraut
> http://developer.postgresql.org/~petere/






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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Help with syntax for timestamp addition
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Wrong string length from unicode database in Borland's app