I know this is not a MySQL board, but I think this is more PHP realted than MySQL related. I'm trying to perform a query on a timesheets database that I have created. I want to limit the query to all records within a 2 week period.
I'm trying to figure out the best way to do this. My dates are stored in the database in seperate columns for day, month and year. What I'm really looking for is a way to get a date range based on 14 days from a specific day (I think).
This is what I have so far:
SELECT month, day, year, hours_worked,
short_desc, client_name, project_name, category_name, billable, rush,
invoice_num, timesheet_id AccountName
FROM timesheet JOIN lu_category_codes, lu_project, lu_client, user_login WHERE
timesheet.employee = user_login.user_id AND
timesheet.client = lu_client.client_id AND
timesheet.category = lu_category_codes.category_id AND
timesheet.project = lu_project.project_id ORDER BY year, month, day
Now I want to limit this to display only the records for the currnet pay period (14 days). Would it be best to concantonate my date, set up some kind of php variable that contains a date range (based on what, I'm not sure yet), and compare the dates in the database with the range variable to get results? Man that sounds terrible. Is there an easier way?