U
U
user_012020-12-19 00:41:30
MySQL
user_01, 2020-12-19 00:41:30

How can I make the values ​​of a SELECT result set column become columns in the final result table?

There is a table with the results of students' assessments:

№ test paper, subject, score
111-111, History, score 11
111-111, Mathematics, score 12
111-111, Biology, score 13
222-222, History, score 21
222-222, Mathematics, score
22 222- 222, Biology, grade23
.....

How queries to display the result in the form:

№test paper, subject1, subject2, subject3, ....
111-111, grade11, grade12, grade13,...
222-222, grade21, grade22 , estimate23,...
.....

The number of items is not known in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-12-19
@user_01

What you want is called transposition, here is your example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question