My tables are these :
Employee Table:
+-----------+----------+------------+
| id | name | department |
+-----------+----------+-----------
SELECT replace(replace(department,'1','CS'),'2','IT') as dept from Employee
You should avoid storing data as comma-separated values, and follow normalization.
However in this case you can do something as
select
e.id ,
e.name ,
group_concat(d.name) from employee e
left join department d on find_in_set(d.id,e.department)
group by e.id ;