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>