Skip site navigation (1) Skip section navigation (2)

Re: About intervals

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Pablo Velasquez Rivas <pvelasquez(at)its(dot)co(dot)cr>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: About intervals
Date: 2004-05-28 21:23:54
Message-ID: 20040528212354.GB1689@wolff.to (view raw or flat)
Thread:
Lists: pgsql-sql
On Fri, May 28, 2004 at 12:27:53 -0600,
  Pablo Velasquez Rivas <pvelasquez(at)its(dot)co(dot)cr> wrote:
> 
> but if I do a query like this, I get:
> / SELECT date2 - date1 as diff FROM table WHERE date2 - date1 >= 
> interval '15:00';/
> * diff
> ------
> (0 rows)
> *
> What can I do to do a query like the previous one , and get the right 
> answer??

It looks like 15:00 is being taking to mean 15 hours 0 minutes.
The more normal syntax for specifying 15 minutes is '15 minutes.
So you probably want:
SELECT date2 - date1 as diff FROM table WHERE date2 - date1 >= interval
'15 minutes';

In response to

pgsql-sql by date

Next:From: kasperDate: 2004-05-30 22:02:06
Subject: multi results with functions
Previous:From: Pablo Velasquez RivasDate: 2004-05-28 18:27:53
Subject: About intervals

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group