SELECT tb_member.mem_id, tb_memberfname_member, tb_member.lname_member FROM tb_member WHERE tb_member.mem_id = (SELECT mem_id FROM tb_enroll) GROUP BY tb_member.mem_id
SELECT tb_member.mem_id, tb_member.fname_member, tb_member.lname_member
FROM tb_enroll LEFT JOIN tb_subject ON tb_enroll.enroll_id = tb_subject.subject_id
LEFT JOIN tb_member ON tb_enroll.mem_id = tb_member.mem_id
WHERE tb_subject.subject_id = '$id'
ORDER BY tb_member.mem_id