-
-
Save harssh/63139b6c94d676248d9de6f8003f1b2e 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