[eluser]theshiftexchange[/eluser]
After hours of mucking around - I still cant get it
I'll simplify the SQL statement:
This is my main select statement - it grabs all the users that are available on a particular day.
Code:
SELECT * FROM overtime_list
JOIN users ON users.user_ID = overtime_list.user_ID
WHERE overtime_list.date = '$date'
Now for each of those users, I want it to check another table to see how much (if any) overtime they have done up to now:
Code:
SELECT SUM(`shift_length`) AS overtime_total FROM (`overtime_assigned`)
WHERE `user_ID` = '.$user_ID
The "WHERE `user_ID` = '.$user_ID " gets me the sum for that individual user
So the idea is all the users on a particular day are always returned, and any that have previously done overtime will have their total included as "overtime_total" on the array
Thanks in advance