From: | Petter Reinholdtsen <pere(at)hungry(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Timespan / interval calculations? |
Date: | 2000-11-02 02:13:59 |
Message-ID: | 200011020213.KAA18168@minerva.ee.uwa.edu.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I'm using PostgreSQL 6.5. I have a table with a timestamp field. I
want to extract all rows with a timestamp less then an hour ago. I've
tried several things, but nothing seem to work. How should it be
done?
I've tried
select * from syslog
where stamp between timestamp('now') - interval('1 hour') and 'now';
select * from syslog
where stamp between timestamp('now') - timestamp('1 hour') and 'now';
but none of these works.
It seem to be something wrong with the interval and timespan types.
pere=> select interval('1 hour');
ERROR: parser: parse error at or near "("
pere=> select timespan('1 hour');
ERROR: Function 'timespan(unknown)' does not exist
Unable to identify a function which satisfies the given argument types
You will have to retype your query using explicit typecasts
pere=>
Should this work, or is it my mistake?
(I'm not on the mailing list, please copy replies to me. :-)
--
##> Petter Reinholdtsen <## | pere(at)td(dot)org(dot)uit(dot)no
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2000-11-02 03:38:54 | Re: INSERT [IGNORE] INTO TABLE |
Previous Message | Najm Hashmi | 2000-11-01 17:56:26 | Re: INSERT [IGNORE] INTO TABLE |