How do I change this SELECT so it is the criteria used for deleting?
SELECT COUNT(empid), empid, status, deptid from tableA
GROUP BY empid, status, deptid HAVING status is null and deptid = 5
What do you want to delete?
If simply records with NULL status in deptId 5, using
WHERE status is NULL and DeptID = 5
Not very clear if you are looking for more than that...