I am filtering my data between start date and end End date. What I am trying to do is I want to filter data between '31-12-2015 11:19:00' And '31-12-2015 11:25:00' with '2' minutes interval
CREATE TABLE table_1
(
timestamp_col timestamp without time zone,
value_col integer
);
INSERT INTO table_1(
timestamp_col, value_col)
VALUES ('2015-12-31 11:19:10', 10),('2015-12-31 11:20:10', 23),
('2015-12-31 11:21:10', 32),('2015-12-31 11:22:10', 43),
('2015-12-31 11:23:10', 55),('2015-12-31 11:24:10', 32),('2015-12-31 11:25:10', 100)
;
This is the Query I am using but not getting result as required
SELECT timestamp_col, value_col
FROM table_1
Where timestamp_col Between '31-12-2015 11:00:00' AND '31-12-2015 12:00:00'
AND date_part('minutes',timestamp_col)::int % 2 = 0
It is resulting data from "2015-12-31 11:20:10" but i want it to start from "2015-12-31 11:19:10" , "2015-12-31 11:21:10" ...... <2 minutes Interval from starting timestamp between the start date and end date>