您好,目前我的数据库中有 4 个表:tb_student、tb_history、tb_section 和 tb_adviser。到目前为止,我用这条线向我展示了一个给定学生的历史:
$qry_display = "SELECT
a.student_id, a.section_id, a.level, a.photo, a.address, a.father_occupation, a.father_phone, a.father_company, a.mother_occupation, a.mother_phone, a.mother_company,a.gpa,
b.fname, b.sex, b.lname, b.mname, b.birth_date, b.birth_place, b.address, b.father, b.father_degree, b.mother, b.mother_degree,
c.section_name, c.adviser_id
FROM tbl_er AS a
LEFT OUTER JOIN tbl_enroll AS b ON a.student_id = b.student_id
LEFT OUTER JOIN tbl_section AS c ON a.section_id = c.section_id
WHERE a.student_id=".$id." AND a.level='1st Year'";
我的主要问题是现在我需要在这些其他信息中显示顾问的姓氏。所以我想把。请注意,tb_adviser 仅通过 advisor_id 连接到 tb_section
LEFT OUTER JOIN tbl_adviser AS d ON a.student_id = c.adviser_id
我在 where 语句之前添加了这一行。并将这一行插入到我的 SELECT 字段中。
d.lname_adviser
目前它不起作用。任何人都会对我的问题有所了解。