Given the following tables:
Player ( id; name number; ) j
team_ficticia ( id; userId; name; puntuacao_ficticia; ) ef
team_fiction_player ( id; teamFicticiaId; pilotId; ) efj
step ( id; local; year; state; ) and
puntuacao_ficticia_player ( id; playerId; stepId; puntuacao_ficticia; ) pfj
In this scenario, several players are part of a team. Each one has a score acquired at a given stage.
I would like as soon as e.status was updated to 'f', a trigger would also be triggered that would search all the players within a certain team in the team_fiction_functions table efj and from that it would be added to the pfj.pontuacao_ficticia of each one of them accumulating these scores in effic.fictuacao_ficticia.