MySQL: Should I keep a running total column in one table instead of summing a second table?
SELECT username, email, achID, SUM(points)
FROM users                        
NATURAL JOIN userAchievements           
NATURAL JOIN achievements
WHERE username = 'johnb'
GROUP BY username, email, achID
WITH ROLLUP
HAVING GROUPING(username) + GROUPING(email) + GROUPING(achID) IN (0, 3)


fiddle


  is there a way to get the output like this? 3 columns "username | email | SUM(points)" with 1 row of "johnb | john@aol.com | 15"


SELECT username, email, SUM(points)
FROM users                        
NATURAL JOIN userAchievements           
NATURAL JOIN achievements
WHERE username = 'johnb'
GROUP BY username, email;