我正在尝试从faculties表中获取数据。但我选择enrolments. 基本上我的想法是显示course那些被录取的教师名称和部分我尝试了所有连接,但没有任何效果。我很困惑如何加入 Laravel Eloquent。$results = Enrollment::select( 'students.rollnumber as student_rollnumber', 'courses.name as course_name', 'courses.course_code', 'sections.name as section_name', 'faculties.fname as faculty_fname', 'faculties.lname as faculty_lname' )->join( 'courses', 'courses.id', 'enrollments.course_id' )->join( 'students', 'students.id', 'enrollments.student_id' )->join( 'sections', 'sections.id', 'enrollments.section_id' )->join( 'faculties', 'faculties.section_id', 'enrollments.section_id' )->join( 'faculty_course_details', 'faculties.id', 'faculty_course_details.faculty_id' )->where('enrollments.student_id',9) ->get();错误:SQLSTATE [42S22]:柱未找到:1054未知列在'字段列表' 'faculties.fname'(SQL:选择students。rollnumber如student_rollnumber,courses。name如course_name,courses。course_code,sections。name如section_name,faculties。fname如faculty_fname,faculties。lname作为faculty_lname从enrollments内连接courses上courses。id= enrollments。course_id内加入students上students。id= enrollments。student_id内连接sections上sections。id= enrollments。section_id其中enrollments。student_id= 9)
- 3 回答
- 0 关注
- 101 浏览
添加回答
举报
0/150
提交
取消