I have TableA which lists customer names in the first field, then the sales to that customer in the next field. There are additional fields after indicating various characteristics of that customer.
Each month, I run QueryA which gives me the sales for the past month to all the customers. I want to add these new sales to the existing sales in TableA.
I am accomplishing this by doing the following:
1. Append QueryA with all sales grouped by CustomerName to TableA. All the new sales actually get added as separate records even for the same CustomerName.
2. Then run another query to group all the CustomerNames in TableA, which combines the separated records into one, and sum up the TotalSales.
Is there a better way to accomplish this? I feel that it is redundant to add all the same CustomerNames twice. The existing record for each CustomerName is already in TableA with the cumulative running total. Then I add the same CustomerName to the table via the Append in step 1 above as a separate line item. Then I re-group and sum up the separate line items.
Each month, I run QueryA which gives me the sales for the past month to all the customers. I want to add these new sales to the existing sales in TableA.
I am accomplishing this by doing the following:
1. Append QueryA with all sales grouped by CustomerName to TableA. All the new sales actually get added as separate records even for the same CustomerName.
2. Then run another query to group all the CustomerNames in TableA, which combines the separated records into one, and sum up the TotalSales.
Is there a better way to accomplish this? I feel that it is redundant to add all the same CustomerNames twice. The existing record for each CustomerName is already in TableA with the cumulative running total. Then I add the same CustomerName to the table via the Append in step 1 above as a separate line item. Then I re-group and sum up the separate line items.