I have two tables
user table
user_id | name |
1 | peter |
2 | kofi |
3 | sam |
4 | nasah |
5 | sarah |
6 | david |
7 | dan |
time table
time_id | user_id | register
1 | 1 | present
2 | 2 | absent
3 | 3 | absent
4 | 4 | present
5 | 5 | absent
in the “time” table under “register” column, user can iether register “present” or “absent” when they login into the system.
I want a mysql query that select users who have either register “absent” or has not register at all.
the return result should be
kofi | absent
sam | absent
sarah | absent
david |
dan |
What about this
Its working, tested here.
Update 1
Per you conversation, you want to further filter based on time/ date
let say i want to find out those who where absent or did not enter the system before 06-13-12 assuming there is a column name “date” in the time table
Use below query
Here is demo for new requirement
Hope this is what you wanted.