I need a query which will update a row in Games to have a value of the average of its recorded Ratings multiplied by the number of Plays it has had. This is what I have so far but it doesn’t seem to be working:
UPDATE Games
SET PlaysRating = ROUND(AVG
(SELECT `Rating` FROM GameRatings WHERE GameID = '37')
* (SELECT COUNT(*) FROM Plays WHERE GameID = '37'))
WHERE ID = 37
Could look like this:
BTW, assuming ID is a numeric type, I removed the quotes
''.