SELECT
M.EMPID
,CASE WHEN M.ID = 1 THEN TA.NAME
WHEN M.ID = 2 THEN TB.NAME
WHEN M.ID = 3 THEN TC.NAME
WHEN M.ID = 4 THEN TD.NAME
FROM
MASTER M
LEFT JOIN TABLEA TA ON TA.EMPID = M.EMPID
LEFT JOIN TABLEB TA ON TB.EMPID = M.EMPID
LEFT JOIN TABLEB TC ON TC.EMPID = M.EMPID
LEFT JOIN TABLEB TD ON TD.EMPID = M.EMPID