[lug] postgresql query question
D. Stimits
stimits at comcast.net
Mon May 15 21:03:51 MDT 2006
George Sexton wrote:
> Is there something that converts the timestamp to seconds? If so, can
> you do:
>
> (convert_to_seconds(date_field) modulo 60) = 0
>
> Nick Golder wrote:
>
>> Is there a way to query data between two timestamps based on some
>> selected interval? For example, I want to query all data for every 60
>> second interval between 2004-09-10 14:00:00 and 2004-10-10 14:00:00.
>> I looked at 'INTERVAL' but that appears to only show it for the first
>> interval after a selected timestamp.
>> TIA,
>>
>
Functions can be viewed in psql via:
\df
Using \df '*now*' shows much.
Try:
SELECT now() - CAST('1 seconds' AS INTERVAL);
The problem with the modulus is that it wants to operate on integers or
numeric types...timestamps don't qualify.
D. Stimits, stimits AT comcast DOT net
More information about the LUG
mailing list