I am going to explain it as simple as possible. Now I have a table_1 which has price and itemId. I also have another table table_2 which has totalprice,itemId.
What I want to do is to sum all price from table_1 grouped by itemId and update that sum of price in table_2 with itemId key as the common column.
The price per itemId summed from table_1 should update the totalprice column in table_2.
Is that possible ? Thank you.
SQL Server 2008 R2
Yes is it possible. You can do like this:
https://data.stackexchange.com/stackoverflow/q/119388/
If you don’t already have all itemid’s in table_2 you can use a merge to update the existing rows and add a new row if it is missing.
https://data.stackexchange.com/stackoverflow/q/119389/