如何添加所有产品并在另一个表中更新数据
我有2个表TB1 =存储,tb2 = daily_quota iwant在TB2中添加所有产品,并在表1
示例表 中更新完成的_product table1=storage
product_name | finished_product |
---|---|
Ascorbic Kids | 30 |
Ascorbic Adults | 20 |
table2=daily_quota
product_name | finished_product |
---|---|
Ascorbic Kids | 30 |
Ascorbic Adults | 30 |
Ascorbic Kids | 30 |
Ascorbic Adults | 30 |
Ascorbic Kids | 30 |
Ascorbic Adults | 30 |
how can i sum all product_name = Ascorbic Kids.finished_product in table2=daily_quota 并更新table1 =存储product_name = ascorbic kids dement_product = table2 = daily_quota中的总和
预期结果表
1 =储存
product_name | prone_name reparoduct |
---|---|
aboduct aboduct abosorbic Kids | 90 |
抗坏血球成人 | 90 |
i have 2 tables tb1=storage and tb2=daily_quota iwant to add all product with the same name in tb2 and update the finished_product in table1
example table
table1=storage
product_name | finished_product |
---|---|
Ascorbic Kids | 30 |
Ascorbic Adults | 20 |
table2=daily_quota
product_name | finished_product |
---|---|
Ascorbic Kids | 30 |
Ascorbic Adults | 30 |
Ascorbic Kids | 30 |
Ascorbic Adults | 30 |
Ascorbic Kids | 30 |
Ascorbic Adults | 30 |
how can i sum all product_name = Ascorbic Kids.finished_product in table2=daily_quota
and update the table1 =storage product_name = Ascorbic Kids finished_product = value of the sum in table2=daily_quota
expected result
table1=storage
product_name | finished_product |
---|---|
Ascorbic Kids | 90 |
Ascorbic Adults | 90 |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议将table1作为视图,您可以根据需要使用。
该视图看起来像:
I would propose to make table1 a view, that you can use as needed.
The view would look like that: