Обсуждение: timestamp differences
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
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
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