I want generate a HTML report, using PHP and the following Mysql data:
VIDEOS
id | title
01 | video1
02 | video2
03 | video3
04 | video4
JURORS
id | Name
01 | juror1
02 | juror2
03 | juror3
REVIEWS
id_video | id_juror | grade
01 | 01 | 5,2
02 | 01 | 4,5
03 | 01 | 2,7
04 | 01 | 7,0
01 | 02 | 3,2
02 | 02 | 9,6
03 | 02 | 4,7
04 | 02 | 8,3
The OUTPUT should be something like that:
| juror1 | juror2 | juror3
video1 | 5,2 | 3,2 | NULL
video2 | 4,5 | 9,6 | NULL
video3 | 2,7 | 4,7 | NULL
video4 | 7,0 | 8,3 | NULL
I have tried many different querys and crosstab tutorials, but they would use CASE for a limited quantity of videos and jurors, but I need it to be dynamic.