Re: [SQL] Time related question... - Mailing list pgsql-sql

From Patrice Hédé
Subject Re: [SQL] Time related question...
Date
Msg-id Pine.LNX.3.96.980617144048.3074A-100000@paris.ivo.fr
Whole thread Raw
In response to [SQL] Time related question...  (kcolagio@wc.eso.mc.xerox.com (Kevin Colagio))
Responses Re: [SQL] Time related question...  (Herouth Maoz <herouth@oumail.openu.ac.il>)
List pgsql-sql
On Wed, 17 Jun 1998, Kevin Colagio wrote:

>
> I have a database that tracks the service calls we do.  In the database
> are abstime values for:
>   dateentered
>   dateclosed
>   dateassigned
>   datecontacted

Can't you design it with 'datetime' fields instead, which is much better
handled ? then, you would be able to do exactly what you want !

> My question is: what is the SQL statement that will allow me to find:
>   1) a list of the calls where the difference between the dateentered and
>   dateclosed is less than (say) 3 days.
>
> I have tried:
>   Select * from servicecall where (dateentered <#> dateclosed) #<= 3 days;
>   Select * from servicecall where (dateclosed  - dateentered) #<= 3 days;
>   Select * from servicecall where (dateentered <#> dateclosed) #<= @3 days;
>   Select * from servicecall where (dateclosed  - dateentered) #<= @3 days;

with datetime, it could be then :

select * from servicecall whre (dateclosed - dateentered) < '3 days';

However, if you really need abstime, I don't know the answer.

Hope this helps

Patrice

--
Patrice HÉDÉ --------------------------------- patrice@idf.net -----
... Ásólfr hljóp upp á skip Hrúts  ok varð fjögurra manna bani,  áðr
Hrútr varð varr við. Sneri hann þá í móti honum. En er þeir fundust,
lagði Ásólfr í skjöld Hrúts ok í gegnum, en Hrútr hjó til Ásólfs, ok
varð þat banahögg.                                    --- Njáls Saga
----- http://www.idf.net/patrice/ ----------------------------------


pgsql-sql by date:

Previous
From: kcolagio@wc.eso.mc.xerox.com (Kevin Colagio)
Date:
Subject: [SQL] Time related question...
Next
From: Herouth Maoz
Date:
Subject: Re: [SQL] Time related question...