So I need some help grouping I think. I have a list of master_id’s in a table with a list of family_id’s for a family address book. each entry gets one master_id, then as many family_id’s as I need to assign them so far up to 3 but most have 2. So my table looks something like:
master_id|family_id
1|1
2|1
2|2
3|1
3|3
4|1
4|2
5|1
5|2
6|1
6|4
What I have set up is to have a family selected so it will return only where family_id = $_POST[fam_id]
I need it to now consider whatever the 2nd family_id for that master_id is and group or order by that number. Does that make sense? How can I do this?
This is my select statement so far:
$sel_id= “(select master_id from master_family where family_id = ‘$_POST[fam_id]’ order by master_id)”;
Thanks for any help I can get on this!