Обсуждение: Extracting time

Поиск
Список
Период
Сортировка

Extracting time

От
"Krog, Kenneth"
Дата:
 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


Re: Extracting time

От
Keary Suska
Дата:
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"

> 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
>