在我的C#代码中,我有两个数据表:
inventory_table
SKU | Title | Qty |
---|---|---|
SAM-GAL-S7-32 | Samsung Galaxy S7 128GB | 5 |
SAM-GAL-S6-64 | Samsung Galaxy S6 64GB | 10 |
IP-13P-128 | Apple iPhone 13 Pro 128GB | 9 |
IP-12-64 | Apple iPhone 12 64GB | 6 |
LG-V60-128 | LG V60 128GB | 3 |
页: 1
SKU | Qty |
---|---|
SAM-GAL-S6-64 | 2 |
IP-13P-128 | 1 |
LG-V60-128 | 1 |
I want to substract the quantity of 页: 1 from the inventory_table for the matching SKU, so the result should be:
inventory_table (updated)
SKU | Qty |
---|---|
SAM-GAL-S7-32 | 5 |
SAM-GAL-S6-64 | 8 |
IP-13P-128 | 8 |
IP-12-64 | 6 |
LG-V60-128 | 2 |
The rows with SKU "SAM-GAL-S6-64", "IP-13P-128" and "LG-V60-128" now have updated quantity. These tables only exists in memory, not in database, and the result table will be exported to a text file. In reality, inventory_table would have a few thousand rows while 页: 1 has 20-30 rows. I believe this task can be done with LINQ. Please advise. Thanks
无。 我需要咨询