I have this table in my db
id | major | code_lesson | files
Which the contents look like this
id | major | code_lesson | files
1 | Math | MAT12 | mat.pdf
2 | Socio | SOC15 | soc.pdf
3 | Math | MAT12 | mat_pre.pdf
4 | Physic| PHY19 | physci.pdf
5 | Physic| PHY19 | phy2.pdf
I want to display this table like this
major |file1 |file2
Math |mat.pdf |math_pre.pdf
Socio |soc.pdf |
Physic|physci.pdf |phy2.pdf
Can you please explain me how to achieve this, since my output result 1 rows :
select major, files as file1, (select files where max(id)) as file2 from db_school
Thanks in advance