For a start you database design could be better. You should have a table for employees, a table for department and a linking table that holds just employee IDs and department IDs to show who is in what.
emp (id, name)
dep (depid, dep_name)
Now you join all three (if you want to search by name) or just emp and emp_dep if searching by depid is enough and you can use NOT IN or something similar to separate out your employees.