Reputation: 335
I have a table that looks like this for a span of many years:
dump_time | group_id | client_count
---------------------+----------+--------------
2014-10-21 19:45:00 | 145 | 74
2014-10-21 19:45:00 | 131 | 279
2014-10-21 19:45:00 | 139 | 49
where dump_time
is of type 'timestamp without time zone'.
I want to select only rows that match a specific week of the year and a specific day of the week. For instance, I want all rows that are 3rd day of the 15th week of the year. Any idea on how I could do this? I've explored the EXTRACT
command, but haven't quite figured it out.
Thanks!
Upvotes: 1
Views: 71
Reputation: 10409
select *
from testme
where extract(week from dump_time) = 15
and extract(dow from dump_time) = 3
Upvotes: 2