Retrieve records from a table which is linked to three tables MySQl -


I have four SQL tables such as modules, lessons, units and users

the relation between these four

1) Module -> Lesson -> Unit.

2) The module is assigned to the user table -> module_user.

Need to recover all the modules based on the User ID and entity ID How can I do this?

Table-module:

  -module_id @onetomany -module_lesson @ multiple-tom -mud_user  

table-lesson:

  lesson_id  

table-unit:

  unit_id  

table- lesson_unit:

  commune_id entity_id  

table-module_ode:

  lesson_id module_id  

Table-module_user:

  module_id user-id  

please give me some ideas

thank you in advance


Comments