I made a select and it looks like this
SELECT name,class_name
FROM students
INNER JOIN classes on classes.id = students.id
and I get a table like
| name | class_name |
| -------- | -------------- |
| Daniel | Math |
| Johnny | Physics |
| Johnny | Math |
| Andrew | English |
...
How am I supposed to split the table to get the first two classes each student attends (students can attend more than two classes or a single class)
Example:
| name | class_1 | class_2 |
| -------- | -------------- | ---------|
| Daniel | Math | |
| Johnny | Math | Physics |
| Andrew | English | |
...
I was thinking of transposing the table, however, I don't know how to actually do it or if it's a good approach.