Update Query Using SumOf

J

Jeffrey

I wish to update a field AggregateBen in table B with the
sum total of field Ben in table A, where the records are
sorted and grouped by field AN. I can get the sum total
of field Ben in table A by

SELECT A.AN, Sum(A.Ben) AS SumOfBen
FROM A
GROUP BY A.AN;

I now have to somehow use the above as a Subquery
following an Update query:

UPDATE B SET AggregateBen = SELECT A.AN, Sum(A.Ben) AS
SumOfBen
FROM A
GROUP BY A.AN;

Only I get an syntax Missing Operator message when I try
to run this. What am I doing wrong? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top