Table1
CycleEndDate ZipCode PiecesMailed PiecesScanned
11072002 39653 1000 0
11072002 71373 600 0
11072002 71334 500 0
11112002 39653 1200 0
11112002 71334 2000 0
Table2
CycleEndDate ZipCode ScanDate PiecesScanned
11072002 39653 11/08/2002 50
11072002 71373 11/08/2002 60
11072002 71373 11/09/2002 100
11112002 39653 11/12/2002 500
11072002 71334 11/12/2002 100
11112002 71334 11/13/2002 40
11112002 71334 11/14/2002 200
I have failed to find a way to write an Access Query or
SQL statement that will read the information in these two tables and update the accumulated values in table2.piecesscanned to table1.piecesscanned.
The query or SQL statement needs to match up table2.CycleEndDate to table1.CycleEndDate and table2.zipcode to table1.zipcode and accumulate the values in table2.piecesscanned for each match and update the accumulated table2.piecesscanned to the matching table1.piecesscanned resulting in the following for table1.
Table1
CycleEndDate ZipCode PiecesMailed PiecesScanned
11072002 39653 1000 50
11072002 71373 600 160
11072002 71334 500 100
11112002 39653 1200 500
11112002 71334 2000 240
I need to update table1 each time records are imported to
table2. I would greatly appreciate any help in solving this problem. I have written an SQL statement that will
show the accumulated values, but have not been able to get the values to update to table1.
HAVE TRIED THE FOLLOWING, BUT GET
Syntax error(missing operator) in query expression 'table1.piecesscanned + table2.piecesscanned From Table2'
Update Table1
Set Table1.PiecesScanned = Table1.PiecesScanned + Table2.PiecesScanned
FROM Table2
Where Table1.CycleEndDate = Table2.CycleEndDate
AND Table1.ZipCode = Table2.ZipCode
CycleEndDate ZipCode PiecesMailed PiecesScanned
11072002 39653 1000 0
11072002 71373 600 0
11072002 71334 500 0
11112002 39653 1200 0
11112002 71334 2000 0
Table2
CycleEndDate ZipCode ScanDate PiecesScanned
11072002 39653 11/08/2002 50
11072002 71373 11/08/2002 60
11072002 71373 11/09/2002 100
11112002 39653 11/12/2002 500
11072002 71334 11/12/2002 100
11112002 71334 11/13/2002 40
11112002 71334 11/14/2002 200
I have failed to find a way to write an Access Query or
SQL statement that will read the information in these two tables and update the accumulated values in table2.piecesscanned to table1.piecesscanned.
The query or SQL statement needs to match up table2.CycleEndDate to table1.CycleEndDate and table2.zipcode to table1.zipcode and accumulate the values in table2.piecesscanned for each match and update the accumulated table2.piecesscanned to the matching table1.piecesscanned resulting in the following for table1.
Table1
CycleEndDate ZipCode PiecesMailed PiecesScanned
11072002 39653 1000 50
11072002 71373 600 160
11072002 71334 500 100
11112002 39653 1200 500
11112002 71334 2000 240
I need to update table1 each time records are imported to
table2. I would greatly appreciate any help in solving this problem. I have written an SQL statement that will
show the accumulated values, but have not been able to get the values to update to table1.
HAVE TRIED THE FOLLOWING, BUT GET
Syntax error(missing operator) in query expression 'table1.piecesscanned + table2.piecesscanned From Table2'
Update Table1
Set Table1.PiecesScanned = Table1.PiecesScanned + Table2.PiecesScanned
FROM Table2
Where Table1.CycleEndDate = Table2.CycleEndDate
AND Table1.ZipCode = Table2.ZipCode