在表中创建单个字段的最佳方法是设计用于保持不同表字段的计算

时间:2022-07-29 20:06:49

i want to save a balance of user, in the user table . the balance calculate from other table rows,

我想在用户表中保存用户的余额。余额从其他表行计算,

is trigger on the other table is the best way ?

在另一张桌子上触发是最好的方法吗?

or do it in script languages like php ?

或者用像php这样的脚本语言来做?

It is important that to be accurate, and performance.

准确和表现非常重要。

thanks

1 个解决方案

#1


I would do it in a view, because that way you always know that it is up to date at the time that the data is retrieved.

我会在视图中执行此操作,因为这样您始终知道在检索数据时它是最新的。

#1


I would do it in a view, because that way you always know that it is up to date at the time that the data is retrieved.

我会在视图中执行此操作,因为这样您始终知道在检索数据时它是最新的。