What would be the best way to print out records with sub-records attached to them? Suppose I have 2 tables, something like this:

User table:

User_id User_name
1 John
2 Mick

Movie table:

User_id Movie_name Rating
1 Die Hard 5
1 MIB 8
2 Iron Man 6

What I want to get, is this:

  • Die Hard (5)
  • MIB (8)

  • Iron man (6)

Should I do an inner join and process the query result using, for example, PHP or is there a better way to organize the result with the help of mysql?