Reputation: 2568
I have a table that has a column called begin_time which is of type timestamp in a postgres db.
begin_time
------------------------
2014-06-02 10:00:00-04
2016-04-07 16:45:00-04
How do I filter based on the minute values in this table? I want the times where minutes = 45.
Thanks for your help!
Upvotes: 2
Views: 1202
Reputation: 161
You can use EXTRACT
combined with WHERE
.
SELECT * FROM your-table
WHERE EXTRACT(MINUTE FROM begin_time) = '45'
For more information about the arguments which can be used with EXTRACT
see the official tutorial
Upvotes: 5
Reputation: 11
You can use the EXTRACT function like this:
SELECT EXTRACT(MINUTE FROM SYSTIMESTAMP) AS CURRENT_MINUTE FROM DUAL;
visit the site http://mycodesoftware.com/ for more details.
Upvotes: 0