How can I join multiple rows in just one single row through mysql?
Example :
Student Table
Sno.| Name | Subjects
1. | ABC | 1
2. | ABC | 3
3. | ABC | 4
4. | FMC | 2
5. | ABC | 4
6. | JBC | 4
Papers Table:
Sno. | Paper Name | Type
1. French Optional
2. English Mandatory
3. Japenese Optional
4. Maths Optional
Now I want it in this format
Sno.| Name| Sub1 | Sub2 | Sub3 | Sub4 |
1. | ABC | French | Japenese| Maths | Null |
2. | FMC | Null | Null | Null | Null |
3. | JBC | Maths | Null | Null | Null |
What i want to select is papers name from papers table and student name, four subjects from the other table. I only want to see those paper which are optional. I am not sure what to do?