I'm trying to set the value in one table to the sum of the values in another table. Something along these lines:
UPDATE table1
SET field1 = SUM(table2.field2)
FROM table1
INNER JOIN table2 ON table1.field3 = table2.field3
GROUP BY table1.field3
Of course, as this stands, it won't work - SET
doesn't support SUM
and it doesn't support GROUP BY
.
I should know this, but my mind's drawing a blank. What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…