This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this select gets correct data | |
SELECT `rez_clubs`.`id`, `rez_clubs`.`name`, SUM(`rez_participants`.`points_1`) | |
FROM `rez_clubs` | |
JOIN `rez_participants` ON `rez_participants`.`club_id` = `rez_clubs`.`id` | |
GROUP BY `rez_participants`.`club_id` | |
-- what im trying to achieve | |
UPDATE `rez_clubs` | |
JOIN `rez_participants` | |
SET `rez_clubs`.`points_1` = SUM(`rez_participants`.`points_1`) | |
WHERE `rez_clubs`.`id` = `rez_participants`.`club_id` | |
GROUP BY `rez_clubs`.`id` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Naktibalda commentedSep 24, 2015