current_timestamp - 20 minutes

Started by Matthew Terenzioover 20 years ago3 messagesgeneral
Jump to latest
#1Matthew Terenzio
matt@jobsforge.com

I 'm storing things in a table with now() and I want to select * from
theTable WHERE the Timestamp is > the current time - 20 minutes

Anyone know the correct syntax. I was trying something like:

WHERE timestamp_field > (timestamp now() - interval '20 minutes')

and will continue reading the manual

#2Joshua D. Drake
jd@commandprompt.com
In reply to: Matthew Terenzio (#1)
Re: current_timestamp - 20 minutes

Matthew Terenzio wrote:

I 'm storing things in a table with now() and I want to select * from
theTable WHERE the Timestamp is > the current time - 20 minutes

Anyone know the correct syntax. I was trying something like:

WHERE timestamp_field > (timestamp now() - interval '20 minutes')

select (now() - interval '20 min');

Sincerely,

Joshua D. Drake

and will continue reading the manual

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--
Your PostgreSQL solutions provider, Command Prompt, Inc.
24x7 support - 1.800.492.2240, programming, and consulting
Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit
http://www.commandprompt.com / http://www.postgresql.org

#3Matthew Terenzio
matt@jobsforge.com
In reply to: Joshua D. Drake (#2)
Re: current_timestamp - 20 minutes

On Jul 12, 2005, at 11:43 PM, Joshua D. Drake wrote:

Matthew Terenzio wrote:

I 'm storing things in a table with now() and I want to select * from
theTable WHERE the Timestamp is > the current time - 20 minutes
Anyone know the correct syntax. I was trying something like:
WHERE timestamp_field > (timestamp now() - interval '20 minutes')

select (now() - interval '20 min');

Gotcha. I owe you another one.

Show quoted text

Sincerely,

Joshua D. Drake

and will continue reading the manual
---------------------------(end of
broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--
Your PostgreSQL solutions provider, Command Prompt, Inc.
24x7 support - 1.800.492.2240, programming, and consulting
Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit
http://www.commandprompt.com / http://www.postgresql.org