Link to home
Start Free TrialLog in
Avatar of sirnutty1
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?
ASKER CERTIFIED SOLUTION
Avatar of aconrad
aconrad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aconrad
aconrad

I cant upload .sql  files, you'll need to rename exp-export.txt to exp-export.sql ....
exp-export.txt
Avatar of sirnutty1

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?

Just figured out a simple addition to the where clause will do it!!

Many thanks again