gpt4 book ai didi

sql - 为表中的列创建默认查询(SQL)?

转载 作者:行者123 更新时间:2023-12-01 00:33:18 25 4
gpt4 key购买 nike

我的一个表中有一列,假设是多个表的行的总和。有没有一种方法我可以有一个在总和列上运行的默认查询,以便每次将一行添加到另一个表时都会在总和列中进行更新。

谢谢

最佳答案

您可能想为此使用 View 而不是表,类似以下内容可能会有所帮助。

Select table.*, sum(otherTable.column) 
from table
inner join otherTable on table.something = otherTable.something

关于sql - 为表中的列创建默认查询(SQL)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2219077/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com