SELECT s.id,c1.name,c2.name,c3.name FROM dbo.student s, code c1, code c2, code c3WHERE s.code1=c1.idAND s.code1=c1.idAND s.code2=c2.idAND s.code3=c3.id