Forum Discussion
Trisha_Ravindra
Mar 20, 2023Copper Contributor
Need Help with sql code
Table1 code description A000 fever A001 stomach virus Table2 MEMBER_NBR code1 code2 12368 A000 NULL 2476 NULL A001 ...
olafhelper
Mar 21, 2023Bronze Contributor
Trisha_Ravindra , your table(s) design is a bit strange. Anyway, this should give you the wanted result:
SELECT *
FROM Table2 AS T2
LEFT JOIN
Table1 AS C1
ON T2.code1 = C1.code
LEFT JOIN
Table1 AS C2
ON T2.code2 = C2.code