我写了这个查询,但没有成功,写作asc and
跟着对方有问题。
我如何解决这个问题?
$q = "SELECT * FROM coe_courses LEFT JOIN equal_coe ON
equal_coe.course_number=coe_courses.course_number
LEFT JOIN student_record ON coe_courses.course_number=
student_record.course_number order by student_record.course_number asc AND student_record.id=". $_SESSION['user_id'];
答案 0 :(得分:0)
您的SQL查询需要重新排列以使用WHERE
子句,如下所示:
$q = "SELECT * FROM coe_courses
LEFT JOIN equal_coe ON equal_coe.course_number=coe_courses.course_number
LEFT JOIN student_record ON coe_courses.course_number=student_record.course_number
WHERE student_record.id=". $_SESSION['user_id'] ."
order by student_record.course_number asc";