Hello,
I am building an app to manage a volleyball club.
The club has various team (for the sake of simplicity let’s say 2: TeamA and TeamB).
Each player can belong to one or multiple teams.
For example Jack belongs to TeamA only; Jill belongs to TeamA AND TeamB
I’ve got 3 tables:
- Players_Teams Table: A junction table connecting players to teams
[Team | Rel_Player
TeamA | Jack
TeamA | Jill
TeamB | Jill]
- Players Table: Contains player information, with a “Rel_Teams" column showing teams they belong to
(relation: Relate to items where the value in: Name Matches the value in:Players_Team–>Players_Name [match multiple])
[Name | Photo | Position | Rel_Team
Jack | photo | OH | TeamA
Jill | photo | S | TeamA TeamB]
- Teams Table: Contains team information (Team_Name) and Rel_Player with related players
Expected:
[Team_Name | Rel_player
TeamA | Jack Jill
TeamB | Jill]
Observed:
[Team_Name | Rel_player
TeamA | Jack
TeamB | ]
The values are correct in the Players Table and Players_Teams Table.
However, in the Teams Table Jill (who belongs to both TeamA and TeamB) does not appear.
My hypothesis is that it has to do with the data structure and the many to many relation, but I cannot figure out what’s wrong and how to fix it.
Any help is much appreciated.
Cheers