Created
June 6, 2013 12:29
-
-
Save tamboer/5721147 to your computer and use it in GitHub Desktop.
sql select employees with contracts between two dates
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
| //not tested 100% there should be some <= >= incorporated depending on ... | |
| $q = "SELECT `employees` | |
| FROM `employee_contract` | |
| WHERE start_date | |
| BETWEEN '$from' | |
| AND '$to' | |
| OR end_date | |
| BETWEEN '$from' | |
| AND '$to' | |
| AND start_date < '$from' | |
| OR end_date > '$to'"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment