Thread: SELECT on a table with Time values

SELECT on a table with Time values

From
Anderson dos Santos Donda
Date:
Hi all!!

I have a simple table with two column. The first column is a time type and the other is a integer type. This table have datas from each minute of day.

Example : 15:00:00, 15:01:00, 15:02:00 etc...

I want a SELECT command  wich return for me the datas from each five minutes of day.

Example: 15:00:00, 15:05:00, 15:10:00, 15:15:00 etc


There is a way to do this?

Re: SELECT on a table with Time values

From
"Dann Corbit"
Date:

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Anderson dos Santos Donda
Sent: Wednesday, February 04, 2009 12:05 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] SELECT on a table with Time values

 

Hi all!!

I have a simple table with two column. The first column is a time type and the other is a integer type. This table have datas from each minute of day.

Example : 15:00:00, 15:01:00, 15:02:00 etc...

I want a SELECT command  wich return for me the datas from each five minutes of day.

Example: 15:00:00, 15:05:00, 15:10:00, 15:15:00 etc


There is a way to do this?

>> 

How about:

SELECT integer_column, timestamp_column FROM my_table

WHERE EXTRACT(MINUTE FROM timestamp_column) % 5 = 0

<<