Re: interval question
От | Eric G. Miller |
---|---|
Тема | Re: interval question |
Дата | |
Msg-id | 20010305193941.A5119@calico.local обсуждение исходный текст |
Ответ на | interval question ("Fernando P. Schapachnik" <fernando@schapachnik.com.ar>) |
Список | pgsql-general |
On Mon, Mar 05, 2001 at 09:59:40PM -0300, Fernando P. Schapachnik wrote: > Hello: > Maybe somebody on the list can give me a hand with this. I > have: > > id serial, > start time, > duration time > > (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. > > The problem is that start+duration is an interval, and I > can't find the way to cast now to interval or interval to time or > tinterval in order to make the comparison. Maybe something like: CREATE start_stop ( id SERIAL, start DATETIME, stop DATETIME ); INSERT INTO start_stop (start, stop) VALUES (now(), now() + '1:00'); SELECT id from start_stop WHERE now() BETWEEN start AND stop; -- Eric G. Miller <egm2@jps.net>
В списке pgsql-general по дате отправления: