xionhack Posted July 23, 2010 Share Posted July 23, 2010 Hello. I have an organization where the members are grouped in teams, which have a team leader, and big groups, which have a group leader. It goes like this, one member can only have one team, meaning one team leader. One team (team leader) takes care of 1 or more than 1 members. 1 team can have 1 or 2 team helpers. Each team is part of 1 group. Each group have a group leader. The group leader is in charge of 1 or more than 1 group leaders. The way i have the tables set up is as follows: Member Table : member_id, name, group_id, team_id, helper_id Team Table: team_id, team_leader, team_helper, team_helper2 Groups Table: group_id, group_leader I dont know if thats the best way to do it, I actually feel its not even close. Does anybody has any input? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/208615-teams-and-group-tables/ Share on other sites More sharing options...
V Posted July 23, 2010 Share Posted July 23, 2010 As long as you have table joins it should be correct. The blueprint you have seems ok. Maybe you can also use a "rank" column. Something like this.. Members: member_id, name, rank, group_id, team_id Groups: group_id, group_name Teams: team_id, team_name, group_id And you can query by ranks. For example.. $rank = "team_leader"; ...."SELECT member_id FROM Members WHERE rank = '$rank'" I think there may be more flexibility if you store the rank in the Members table Quote Link to comment https://forums.phpfreaks.com/topic/208615-teams-and-group-tables/#findComment-1089966 Share on other sites More sharing options...
V Posted July 23, 2010 Share Posted July 23, 2010 You'll still need to store the leader ID in the Teams and Gropu table. I forgot to add it Quote Link to comment https://forums.phpfreaks.com/topic/208615-teams-and-group-tables/#findComment-1089968 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.