make an equal ID group

Asked

Viewed 28 times

1

Well, I have a table that returns 5 users, and among these 5 may be equal teamID, 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 equal being, if who is id 51, belongs to team 1, id 52 belongs to team 2, which has id NULL has no time(detail there may be occasions that all are of the same id).

here is an example of how it works, there are 2 teams, winning team has a full group, losing team has 1 group of two people, but I’m showing the ID instead of team 1 and 2.3 etc..

https://theevie.club/match/PC/212048062

1 answer

0

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.