by Richard Oelmann.
I would probably approach it from the other direction
The mdl_assign_submission table gives all the submissions with the userid and the assignment id - if you join to the mdl_assign table that will tell you what course the assignment is in and the assignment name. Would that give you student, course and assignment information to be able to diplay as you need it?
Richard