Thread: showing records from the last 20 min

showing records from the last 20 min

From
Matthew Nuzum
Date:
I know this is such a simple question, but I can't find the answer in
the manual and I've tried very hard to find it.

I want to show all the records in a table that occurred in the last 20
min.

So, maybe something like:
select * from sys_logins WHERE tstamp >= now() - '00:20';

on pg 7.3.2 this produces the error:
ERROR:  Bad timestamp external representation '00:20'
Thanks for any help,
-- 
Matthew Nuzum
cobalt@bearfruit.org
www.bearfruit.org



Re: showing records from the last 20 min

From
Tomasz Myrta
Date:
Użytkownik Matthew Nuzum napisał:
> I know this is such a simple question, but I can't find the answer in
> the manual and I've tried very hard to find it.
> 
> I want to show all the records in a table that occurred in the last 20
> min.
> 
> So, maybe something like:
> select * from sys_logins WHERE tstamp >= now() - '00:20';
> 
> on pg 7.3.2 this produces the error:
> ERROR:  Bad timestamp external representation '00:20'
>  
> Thanks for any help,
Did you mean:
select * from sys_logins
WHERE tstamp >= now()-cast('20:00' as interval);
?

Regards,
Tomasz Myrta



Re: showing records from the last 20 min

From
Matthew Nuzum
Date:
On Tue, 2003-03-18 at 13:19, Tomasz Myrta wrote:
> > I want to show all the records in a table that occurred in the last 20
> > min.
> > 
> > So, maybe something like:
> > select * from sys_logins WHERE tstamp >= now() - '00:20';
> Did you mean:
> select * from sys_logins
> WHERE tstamp >= now()-cast('20:00' as interval);

Yes, I guess I did.  ;-)  Thanks for the help.
-- 
Matthew Nuzum
cobalt@bearfruit.org
www.bearfruit.org



Re: showing records from the last 20 min

From
Rajesh Kumar Mallah
Date:

the age function can also be used i guess.

where age(tstamp) <  '20 mins'::interval


regds
mallah.

On Tuesday 18 Mar 2003 11:49 pm, Tomasz Myrta wrote:
> Użytkownik Matthew Nuzum napisał:
> > I know this is such a simple question, but I can't find the answer in
> > the manual and I've tried very hard to find it.
> >
> > I want to show all the records in a table that occurred in the last 20
> > min.
> >
> > So, maybe something like:
> > select * from sys_logins WHERE tstamp >= now() - '00:20';
> >
> > on pg 7.3.2 this produces the error:
> > ERROR:  Bad timestamp external representation '00:20'
> >
> > Thanks for any help,
> Did you mean:
> select * from sys_logins
> WHERE tstamp >= now()-cast('20:00' as interval);
> ?
>
> Regards,
> Tomasz Myrta
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>

--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.