I have two MySQL tables, g734 and g8internal. I ran an SQL SELECT query given below in which I would like to put the result of the query to the Maths field and Total_Score field in table g8internal. The fields in g734 and g8internal are uniform. They are StudentID, FirstName, LastName, Maths and Total_Score. Please have a look at my SQL code below. The one I have is giving SQL syntax error in phpMyAdmin. I would like to store the result of the query to Total_Score and Maths in g8internal.
SELECT StudentID, FirstName, LastName, SUM(Total_Score) AS T_Score, SUM(Maths) AS Mth
FROM
(
SELECT StudentID, FirstName, LastName, Total_Score, Maths FROM g734
UNION ALL
SELECT StudentID, FirstName, LastName, Total_Score, Maths FROM g8internal
) t on g8internal.FirstName = g734.FirstName AND g8internal.LastName = g734.LastName
GROUP BY StudentID, FirstName, LastName
SET g8internal.Total_Score = T_Score,
g8internal.Maths = Mth