Re: [SQL] Time related question...

From: Patrice Hédé <patrice(at)idf(dot)net>
To: Kevin Colagio <kcolagio(at)wc(dot)eso(dot)mc(dot)xerox(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Time related question...
Date: 1998-06-17 12:45:15
Message-ID: Pine.LNX.3.96.980617144048.3074A-100000@paris.ivo.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)idf(dot)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/ ----------------------------------

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Herouth Maoz 1998-06-17 13:02:15 Re: [SQL] Time related question...
Previous Message Jose' Soares Da Silva 1998-06-17 12:23:51 Re: [SQL] cast text as date