I have two tables (points, pointsmatch)
Table 'points' have following fields
id (int)
seriesid (int)
team (varchar)
points (int)
id seriesid team points
1 9 Chennai 4
2 9 Delhi 0
3 9 Kolkata 0
4 9 Mumbai 0
5 9 Bangalore 0
6 9 Mohali 0
7 9 Rajasthan 0
8 9 Pune 0
9 9 Hyderabad 0
Table 'pointsmatch' will list each match details alsong with points table which have following fields
id (int)
seriesid (int)
team1 (varchar)
team2 (varchar)
team1_points (int)
team2_points (int)
id team1 team2 seriesid result team1_points team2_points
1 Chennai Mumbai 9 won 2 0
2 Kolkata Delhi 9 loss 0 2
3 Mumbai Pune 9 loss 0 2
4 Rajasthan Mohali 9 won 2 0
5 Bangalore Delhi 9 won 2 0
6 Hyderabad Chennai 9 loss 0 2
7 Rajasthan Kolkata 9 won 2 0
Below is query I am executing
UPDATE points A SET A.points = (SELECT sum(team1_points) as points1 FROM pointsmatch B WHERE A.team = B.team1 AND A.seriesid = B.seriesid GROUP BY B.team1) + (SELECT sum(team2_points) as team2_points FROM pointsmatch B WHERE A.team = B.team2 AND A.seriesid = B.seriesid GROUP BY B.team2)
But only three rows are being updated and not the all (total 9 rows). Anyone here to help me.