select Evdid,
(select userName from b where userid = managerID) userName1,
(select userName from b where userid = depManagerID) userName2,
others
from a;
(select userName from b where userid = managerID) userName1,
(select userName from b where userid = depManagerID) userName2,
others
from a;
from a,b b1,b b2
where a.managerID=b1.userid
and a.depManagerID=b2.userid