だから私は3つのテーブルを持っています:
student
-studentid
-studentname
course_offerings
-course_offeringid
-course
-type
scores
-student_studentid
-course_offering_course_offeringid
-score
クエリを実行すると:
SELECT studentid, studentname, course, type, score
FROM scores
INNER JOIN student ON scores.student_studentid = student.studentid
INNER JOIN course_offering ON scores.course_offering_course_offeringid = course_offering.course_offeringid
次のような出力が得られます。
studentid studentname course type score
123345 Doe, John 123 Exam 1 100
123345 Doe, John 123 Exam 2 95
123345 Doe, John 123 Exam 3 75
123345 Doe, John 123 Final 93
543211 Doe, Jane 123 Exam 1 70
543211 Doe, Jane 123 Exam 2 91
543211 Doe, Jane 123 Exam 3 99
543211 Doe, Jane 123 Final 43
.
.
.
私が望むのは、出力が次のようになることです。
studentid studentname course Exam 1 Exam 2 Exam 3 Final
123345 Doe, John 123 100 95 75 93
543211 Doe, Jane 123 70 91 99 43
これは MySQL だけで可能ですか?