SELECT ENROLL.SID, MAX(SCAN.COME)
FROM ENROLL
LEFT JOIN SCAN ON
ENROLL.SID = SCAN.SID AND scan.codeno = "ce355"
AND scan.groups = "002" AND scan.semester = "เทอม 2"
AND scan.years = "2554"
WHERE
ENROLL.CODENO = "ce355" and enroll.groups = "002"
and enroll.semester = "เทอม 2" and enroll.years = "2554"
GROUP BY ENROLL.SID