3

I have three tables structure like this

1- users table

   +--------+----------+
   | users  | username |
   +--------+----------+
   |   1    |    A     |
   +--------+----------+
   |   2    |    B     |
   +--------+----------+
   |   3    |    C     | 
   +--------+----------+
   |   4    |    D     |
   +--------+----------+

2- Course Assigning table

   +--------+----------+
   | userID | courseID |
   +--------+----------+
   |   1    |    3     |
   +--------+----------+
   |   1    |    4     |
   +--------+----------+
   |   1    |    5     | 
   +--------+----------+
   |   1    |    6     |
   +--------+----------+

3- Quiz Report Table

   +--------+----------+----------+
   | quizId | courseId |  Obtmarks|
   +--------+----------+----------+
   |   1    |    4     |      10  |
   +--------+----------+----------+
   |   2    |    5     |      20  |
   +--------+----------+----------+
   |   3    |    6     |      30  |
   +--------+----------+----------+
   |   4    |    3     |      05  |
   +--------+----------+----------+

how i can get this format like this

   +-------------+------------+---------------+---------------+
   |   username  | courseid-3 | courseid-4    | courseid-5    |
   +-------------+------------+---------------+---------------+
   |     A       |   05       |     10        |      20       |
   +-------------+------------+---------------+---------------+
   |     B       |  null      |   null        |    null       |
   +-------------+------------+---------------+---------------+
   |     C       |  null      |   null        |    null       |
   +-------------+------------+---------------+---------------+

I am very confused and done a lot of tries but didn't get it.

halfer
  • 19,824
  • 17
  • 99
  • 186

0 Answers0