在这里,我的表像这样从另一列插入数据 “后触发插入”
目的地:
|id_dest | price |
| 1 |2000 |
| 2 |100 |
| 3 |1000 |
项目:
|id_item | weight | id_dest |total(weight*destination.price) |
| 1 | 3 | 2 |
触发应该
|id_item | weight | id_dest |sum(weight*destination.price) total |
| 1 | 3 | 2 |300
查询如何触发应该是?
为什么不使用生成的列? https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html – Barmar
SO不是免费的编码服务。你必须尝试自己解决问题。如果无法正常工作,请发布您尝试的内容,我们会帮助您解决问题。 – Barmar
生成的列不起作用,因为只能使用来自同一行的列。 –