Extracting time

Started by Krog, Kennethover 24 years ago2 messagesgeneral
Jump to latest
#1Krog, Kenneth
KAKrog@MassMutual.com

I am attempting to do a query for a specific time based of a response for
a web site using php as the engine.
The syntax of the sql is simple

"SELECT * FROM table WHERE EXTRACT(MINUTE FROM fieldname)=$var;"

Specifically I am trying to pull up the last 30 minutes worth of data that
someone entered.

Thanks in advance

#2Keary Suska
hierophant@pcisys.net
In reply to: Krog, Kenneth (#1)
Re: Extracting time

You are better off avoiding the overhead of calling a function:

SELECT * from table WHERE time + '30 minutes'::interval >= CURRENT_TIME

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

Show quoted text

From: "Krog, Kenneth" <KAKrog@MassMutual.com>
Date: Mon, 1 Oct 2001 13:09:02 -0400
To: pgsql-general@postgresql.org
Subject: [GENERAL] Extracting time

I am attempting to do a query for a specific time based of a response for
a web site using php as the engine.
The syntax of the sql is simple

"SELECT * FROM table WHERE EXTRACT(MINUTE FROM fieldname)=$var;"

Specifically I am trying to pull up the last 30 minutes worth of data that
someone entered.

Thanks in advance

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly