Jump to content

Select Employee with no Attendance


newphpcoder

Recommended Posts

Hi Good day!I have 2 tables for my dtr database.first the employees where all the data of employee was save.employees fields:EmployeeIDLastnameFirstnameSubDepartmentattendance_logEMP_IDLOG_TIME (datetime)INDICATORI tried lots of query to get the EmployeeID where no attendance on the date I want to check who are the absentee.I just want to select the EmployeeId where no LOG_TIME with the date 2013-05-02attendance_log table is the table where the time in and out was save.I hope somebody can help me to get only the EmployeeId with no attendance where Sub = 'REG' and Department IN ('QA', 'Engineering', 'Assembly').Thank you

Link to comment
Share on other sites

You can use NOT IN with a subquery, e.g.: SELECT * FROM employees WHERE employeeID NOT IN (SELECT EMP_ID FROM attendance_log WHERE ...) That will return employees that are not in the other query, so you can add your date condition to the subquery to look for employees without attendance logs during a particular time. You can add additional conditions to the where clause to further filter the list of employees.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...