Re: interval question - Mailing list pgsql-general

From Fernando P. Schapachnik
Subject Re: interval question
Date
Msg-id 200103062235.f26MZgO00717@funes.schapachnik.com.ar
Whole thread Raw
In response to Re: interval question  (dev@archonet.com)
List pgsql-general
En un mensaje anterior dev@archonet.com escribió:
> On 3/6/01, 12:59:40 AM, Fernando "P." Schapachnik
> <fernando@schapachnik.com.ar> wrote regarding [GENERAL] interval question:
>
> > Hello:
> >       Maybe somebody on the list can give me a hand with this. I
> > have:
> > id serial,
> > start time,
> > duration time
>
> Surely "duration" should be of type interval.
> Also - are you sure "start" should be time and not timestamp - depends if
> you don't care about dates.
>
> >       (That is, ids have an start time and a duration).
>
> >       I want to know which ids are current, ie, which satisfy
> > start<=now<=start+duration.
>
> SELECT id FROM foo WHERE start<=now() AND now<=(start + duration);

It worked fine! Thanks!


Fernando P. Schapachnik
fernando@schapachnik.com.ar

pgsql-general by date:

Previous
From: Chris Hayner
Date:
Subject: help with simple rule
Next
From: Erik Tennant
Date:
Subject: JRelationalFramework