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:
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!
$lunch = "SELECT data.uid, data.date, data.time, data.trutime, data.reason, users.FirstName, users.LastName, users.uid
FROM data, users
data.uid = users.uid
data.date LIKE '%-$month-%'
data.reason = 'lunch_leave'
data.reason = 'lunch_return'
ORDER BY data.date, data.trutime";