I try to update my users points based on a SUM from another table.
UPDATE users u
INNER JOIN
(
SELECT user_id, SUM(user_score_for_answer) as total
FROM answer_histories
GROUP BY user_id, total
) a ON users.id = a.user_id
SET U.points = a.total
ERROR: syntax error at or near "INNER"