sirnutty1
asked on
PHP Join and filter from multiple tables
Hi Experts
Would appreciate some wise words, can't get my head around this one.
I have 3 tables:
students
groups
group_assignments
Basically the student table contains all the info, the groups table lists a simple list of available groups and the group_assignments table lists details of which student belongs to which group.
I am currently returning a complete list of students with no problem but I would like to be able to include the student group details in the recordset and filter on it.
Simple enough if each student only belongs to one group but most of them belong to many. What would be the best approach?
Would appreciate some wise words, can't get my head around this one.
I have 3 tables:
students
groups
group_assignments
Basically the student table contains all the info, the groups table lists a simple list of available groups and the group_assignments table lists details of which student belongs to which group.
I am currently returning a complete list of students with no problem but I would like to be able to include the student group details in the recordset and filter on it.
Simple enough if each student only belongs to one group but most of them belong to many. What would be the best approach?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks for your answer aconrad, works perfectly!!
Can you just clarify how I would then perform a filter on the group_concat columns?
Would I use a WHERE clause in the mySQL query or something else?
Can you just clarify how I would then perform a filter on the group_concat columns?
Would I use a WHERE clause in the mySQL query or something else?
ASKER
Just figured out a simple addition to the where clause will do it!!
Many thanks again
Many thanks again
exp-export.txt