Created
November 17, 2016 16:41
-
-
Save mamantoha/64c3fd7963701372df460416f3a902ff to your computer and use it in GitHub Desktop.
PostgreSQL: query to select records from last week on weekdays between 9:00 and 18:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model | |
.where( | |
"EXTRACT(dow FROM log_in) IN (1,2,3,4,5)" | |
) | |
.where( | |
"log_in::time BETWEEN '9:00' AND '18:00'" | |
) | |
.where( | |
"log_in BETWEEN now()::timestamp - (interval '1 week' AND now()::timestamp)" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment