⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

how to make a where clause in set_relation_n_n from a fourth table?



Juan Carlos

Juan Carlos
  • profile picture
  • Member

Posted 29 October 2014 - 15:49 PM

I need your help, as I can do a set_relation_n_n using a clause where to filter data based on the information that is in another set_relation_n_n 
 
Attached is a picture, 
 
my relational table 1 is perfect, however the relational Table 2 need to filter users who are involved in a project (information stored in relational table 1) 
 
mysql would look like:

 

SELECT project_user.id_user, user.name, user.lastname, activity.id_activity FROM user INNER JOIN project_user ON user.id_user = project_user.id_user INNER JOIN activity ON project_user.id_project = activity.id_project WHERE activity.id_project='$id_project' AND project_user.id_project = '$id_project'

 

 

The idea is that in set_relation_n_n 2 (relation table 2) show me only those who are already involved in the project to which the activity belongs