timestamp differences

Started by Garry Saddingtonover 17 years ago3 messagesgeneral
Jump to latest
#1Garry Saddington
garry@schoolteachers.co.uk

I have a timestamp column that I want to compare with current timestamp.
I want to get all rows that are less than 10 minutes old. I have searched but
can not find how to do this, any pointers?
regards
Garry

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Garry Saddington (#1)
Re: timestamp differences

On Sunday 28 December 2008 1:40:28 pm Garry Saddington wrote:

I have a timestamp column that I want to compare with current timestamp.
I want to get all rows that are less than 10 minutes old. I have searched
but can not find how to do this, any pointers?
regards
Garry

select * from foo where ts_fld > now() - 'interval 10 min'

--
Adrian Klaver
aklaver@comcast.net

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Adrian Klaver (#2)
Re: timestamp differences

On Sunday 28 December 2008 1:53:30 pm Adrian Klaver wrote:

On Sunday 28 December 2008 1:40:28 pm Garry Saddington wrote:

I have a timestamp column that I want to compare with current timestamp.
I want to get all rows that are less than 10 minutes old. I have searched
but can not find how to do this, any pointers?
regards
Garry

select * from foo where ts_fld > now() - 'interval 10 min'

--
Adrian Klaver
aklaver@comcast.net

Coffee refill
Should be:
select * from foo where ts_fld > now() - interval '10 min'

--
Adrian Klaver
aklaver@comcast.net