About intervals - Mailing list pgsql-sql

From Pablo Velasquez Rivas
Subject About intervals
Date
Msg-id 40B784A9.70306@its.co.cr
Whole thread Raw
Responses Re: About intervals
List pgsql-sql
Hi all.<br /> I have a table with some timestamps fields. For example this table:<br /><br /><b>             
date1       |         date2        <br /> -----------------------------+---------------------------<br />  2004-03-01
11:20:00| 2004-03-01 11:55:00</b><br /><br /> If I do a query like this, I get:<br /><br /><i> SELECT date2 - date1 as
diffFROM table</i>;<br /><b> diff  <br /> -------<br />  00:35<br /> (1 row)<br /></b><br /><br />  but if I do a query
likethis, I get:<br /><i> SELECT date2 - date1 as diff FROM table WHERE date2 - date1 >= interval '15:00';</i><br
/><b> diff<br /> ------<br /> (0 rows)<br /></b><br /> What can I do to do a query like the previous one , and get the
rightanswer??<br /><br /> Thanks !!<br /><div class="moz-signature">-- <br /></div><span style="font-weight:
bold;">==                                ==<br />    Pablo A. Velasquez Rivas<br /> Computer Science Engineer<br />
==                                ==<br /></span><i> All programmers are optimists </i> -- Frederick P. Brooks, Jr.<br
/>

pgsql-sql by date:

Previous
From: "Atesz"
Date:
Subject: Re: OR clause causing strange index performance
Next
From: Bruno Wolff III
Date:
Subject: Re: About intervals