Reputation: 397
I have a table with soccer scores. Whenever I add a score to one player it automatically adds NULL in the same row for the other players:
Like this:
player1 1-0, NULL, 4-1
player2 5-2, 4-1, NULL
player3 2-1, NULL, NULL
What I want is when I add a new score to a player, the Null should be replaced with that value (for example for player one it should be 1-0
, 4-1
and not 1-0
, NULL
, 4-1
)
How can I do that?
Upvotes: 0
Views: 2401
Reputation: 17553
In your question you seem to have three columns next to each player. Why is that? What are those columns representing?
I propose that the cells in your examples are games, and that's really what you're modelling. You should create a game
table with columns such as player1
, player2
, score1
, score2
. That would model who played against whom, and what the respective scores were.
You could add further information to each game, for example, when the game was played.
Upvotes: 0