I have a timesheet and several people use it
users has the username and id of the user, this is lined to timesheet which stores the date and user_id, user_id and id are the link so table 2 might have a new entry for everyday.
Now what im trying to do is gather a list of people who havent updated their timesheet for today. Here is my newbie attempt
select * from users left join timesheet ON users.id =
timesheet.user_id WHERE timesheet.user_id is null AND timesheet.value
is null
This returns all the users who dont have a timesheet entry which is perfect but im querying a specific day so if they filled it out yesterday theyll have a corresponding entry in timesheet but it still means they havent filled it out today.
I tried
select * from users left join timesheet ON users.id =
timesheet.user_id WHERE timesheet.user_id is null AND timesheet.value
is null AND timesheet.date != ’12-09-05′
I can see the flaw in that logic, i already excluded the people i want to further filter by date but i cant get my head around how to get the result i want. I really want it to filter by date first and then run that querybut im not sure how to do that as im not too familiar with MySQL and google said he didnt know the answer
Move the date condition to the
ONclause: