select subjectname,usercode,firstname
from register t1 left outer join subject t2 on t1.subjectid = t2.subjectid , user t3
where t1.usercode=t3.usercode
<?php
$strSQL2 = "SELECT * FROM subject left outer join register on subject.subjectid=register.subjectid where subject.programcode IN('".$userResult["programcode"]."','4')";
$objQuery2 = mysql_query($strSQL2);
?>