I have a query like this.
select pid,deptid from table1
;
in which deptid
is varchar
and value like (1,3,4)
Now I have another table as department(deptid(int,PK), DeptName)
I want instead of get deptid from select I can get deptNames in csv.like
pid | deptname
1 | dept1,dept4,dept7
2 | dept4,dept9
What should be approach for this.