Reputation: 1614
I am trying to select records that occurred on Sun, Mon, Wed between 0:00 and 1:00. The dow part of this request is working but the 'hour' part does not seem to be included in the query. What have I done wrong? I feel like I am missing some parenthesis
SELECT * FROM myTable
WHERE date_part('dow',date)=0
OR date_part('dow',date)=1
OR date_part('dow',date)=3
AND date_part('hour',date)<=1
AND date_part('hour',date)>= 0
Upvotes: 0
Views: 108
Reputation: 3108
Try this :
SELECT *
FROM myTable
WHERE (date_part('dow',date) In(0,1,3)) AND (date_part('hour',date)<=1 AND date_part('hour',date)>= 0)
Upvotes: 1