Ask for leave table, users table clock in table table, punch watch off table are associated with the user id
My idea is to find out all information clock in that month, found to leave the user information, and then let the users table to heavy punch table and leave table, the rest is after absenteeism,
But the clock in time is how to judge, because found to clock in all of the users, not clear whether there is absent that day, according to the check in, as long as the user played CARDS during the month, this is meaningless, so I want to help, how to clear the user on the day of absence, absenteeism information, check a month all follow the day to check absence has been found out,
CodePudding user response:
- assuming that this is your clock watch
The CREATE TABLE check_on (
Id int (10) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'PRIMARY KEY on the id,
Start_time datetime NULL COMMENT 'clock time,
End_time datetime NULL COMMENT 'punch out time,
User_id varchar (20) NULL COMMENT 'user id',
The info int (10) NULL comment '1 represents the default 0'
);
Select *
The from check_on
Where the info=0
And start_time is null
The or end_time is null
Group by user_id
- determine the date for the month
No test don't know right