Hey Everyone,
A few days ago I posted a question about getting a timeclock database/web front end to behave properly and got great responses...I'm hoping to duplicate that with this issue:
Lunch Overages
I need to run a query that will pull when they left and when they got back (easy enough.) However, here's where the water gets over my ears; I also need to then subtract the leave time from the arrive time for each user for each day THEN only return the results that are longer than 30 minutes.
Here's the query that I'm running to pull the 411:
the month is posted in from a form on the previous page. Not sure if a foreach php run or straight mysql loop will work to do what I need it to do, but any help will be greatly appreciated!Code:$lunch = "SELECT data.uid, data.date, data.time, data.trutime, data.reason, users.FirstName, users.LastName, users.uid FROM data, users WHERE data.uid = users.uid AND data.date LIKE '%-$month-%' AND ( data.reason = 'lunch_leave' OR data.reason = 'lunch_return' ) ORDER BY data.date, data.trutime";
Thanks
Josh


Reply With Quote
Bookmarks