Problem in displaying of data from select statement its consume lots of time
I have query to get all the employees which has no in and out it means they are absent
here is my code:
this code works but the problem is too long to query. it consumes 5-15mins before display the data.
SELECT emp.employeeid, emp.lastname, emp.firstname, emp.middlename, emp.department
FROM employees AS emp
JOIN attendance_log AS att
ON att.emp_id = emp.employeeid
AND DATE(att.log_time) = '2013-11-05'
WHERE emp.sub LIKE '%REG%'
AND emp.department IN ('Assembly', 'Fabrication', 'Compounding', 'Finishing', 'PET', 'Production', 'Squash', 'QA', 'ENGINEERING')
AND att.emp_id IS NULL;
I hope somebody can help me to change my query for faster displaying of data.