make a group of IDs equal

1

Well, I have a table that returns 5 users, and among those 5 there can be equal teamIDs, for example:

usuario1 = teamid: 51
usuario2 = teamid: 51
usuario3 = teamid: 55
usuario4 = teamid: 55
usuario5 = teamid: null

I would like to know how I would define a group for them by id being equal, if the who is id 51, belongs to team 1, id 52 belongs to team 2, which has id NULL has no team (detail may be occasions that all are of the same id).

Here is an example of how it works, there are 2 teams, team winner has a complete team, team loser has 1 group of two people, however I am showing the ID instead of time 1 and 2,3 etc .. < p>

link

    
asked by anonymous 08.02.2018 / 05:54

1 answer

0

You should probably make an auxiliary table containing the temid and the group with your name, for example: 55 = group 1 and 51 = group 2, including more details about this group.

Search the internet for a foreign key in a database that is what you need. Then you can try to implement this on your system

    
08.02.2018 / 11:55