I am trying to update multiple columns from one table based on the results of another table
So I have 3 tables as follows
HISTORY
SUMM_SNAP
ADM_CHOICE
My SQL code is loosely
SELECT SUM(H.HIS1), SS.SNAP1, AC.ADM1
FROM
HISTORY H,
SUMM_SNAP SS,
ADM_CHOICE AC
WHERE H.HIS2=SS.SNAP2
AND SS.SNAP3=AC.ADM2
GROUP BY SS.SNAP1, AC.ADM1
This works, and I am able to SUM the column as I need with the right numbers.
I altered the SUMM_SNAP table and now I want this summarized column to be in the table
I tried using UPDATE, but there is no FROM clause to let me do the table join/group by
UPDATE SUMM_SNAP
SET SUMM_SNAP.SNAP3=SUM(H.HIS1)
FROM
HISTORY H,
SUMM_SNAP SS,
ADM_CHOICE AC
WHERE H.HIS2=SS.SNAP2
AND SS.SNAP3=AC.ADM2
GROUP BY SS.SNAP1, AC.ADM1
The above is obviously wrong - but just trying to show whatI was thinking
What would be the best method to get the numbers from the SUM into a table?