Hi everyone,
I'm working modifying this small PHP time keeping program for a college I work for. This program keeps track of times that employees enter (it's not the time they enter it, as most people work away from the office, so they come by and punch multiple entries in at the same time).
I'm working on a function that will generate reports to show how many hours each person worked during a week. The dates are stored in one column (punch_date) in the format of 02.25, while the years are stored in another (punch_year), in the format 2009.
I am trying to figure out the query to use for this information:
-where punch_date is between 02.23 and 02.27 (including those two days)
-where punch_year is exactly 2009
I didn't write the original program (the guy working before me did). If I did, I would've made a different database design. But since the punches are already in this database, I have to keep it.....
(mysql) Selecting between two variables while matching a 3rd
Moderator: General Moderators
Re: (mysql) Selecting between two variables while matching a 3rd
If the date uses padded numbers (2 -> 02) in MM.DD format then you can use regular comparison operators.
Code: Select all
...WHERE punch_date BETWEEN "02.23" AND "02.27" AND punch_year="2009"