I have a table like teachers rate (1-5) students every week. Each teacher can rate each student only once druing a week.

And I won’t know how many weeks are there it could be any number between 1 to 52

id, week_number, student, teacher, rating

1, 1, Student1, Teacher1, 3

2, 1, Student2, Teacher2, 5

3, 2, Student1, Teacher1, 5

4, 2, Student2, Teacher2, 4

4, 2, Student1, Teacher2, 5

I want to display yearly rating data for a selected student say Student1

Teacher, Week 1, Week2, Week 3…

Teacher1, 3, 2, -

Teacher2, -, 5, -

week_number above actually links to a weeks table through id so I can find out how maany weeks are going to be there. But I am not able to produce the output I want.

It is trying to split row data into rows and columns. The above is simplified version of actual table.

Any working solutions?