UPDATE tblplayers a,
(
SELECT SUM(COALESCE(co stCP, 0)) AS CPCOUNT, forumMemberID
FROM tblplayers c
LEFT OUTER JOIN tblplayerabilit ies a ON a.playerID = c.forumMemberID
LEFT OUTER JOIN tbldoctrineabil ities b ON a.abilityID = b.abilityID
GROUP BY CP, forumMemberID
) b
SET a.CP = 15 - (b.CPCOUNT+a.CP )
WHERE a.forumMemberID = b.forumMemberID
AND (b.CPCOUNT+a.CP ) < 15
--
I appears to hate the (b.CPCOUNT+a.CP ) portion in the SET statement. If I use an integer there, it works fine. Maybe there's another way to do this?
(
SELECT SUM(COALESCE(co stCP, 0)) AS CPCOUNT, forumMemberID
FROM tblplayers c
LEFT OUTER JOIN tblplayerabilit ies a ON a.playerID = c.forumMemberID
LEFT OUTER JOIN tbldoctrineabil ities b ON a.abilityID = b.abilityID
GROUP BY CP, forumMemberID
) b
SET a.CP = 15 - (b.CPCOUNT+a.CP )
WHERE a.forumMemberID = b.forumMemberID
AND (b.CPCOUNT+a.CP ) < 15
--
I appears to hate the (b.CPCOUNT+a.CP ) portion in the SET statement. If I use an integer there, it works fine. Maybe there's another way to do this?
Comment