如何在Sql Server中添加列的值? [英] how to add values of column in Sql Server?

查看:254
本文介绍了如何在Sql Server中添加列的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表名Tblaccount



i有以下专栏

clientID

OrderID
AccountID //主键

AccountReceive

AccountBalance

TotalAccount



i想要添加客户端的所有值AmmountBalce Columns

然后在Gtotalbaltextbox中显示

并且还想知道我是否从GTotaltextbox减去一些金额如何保存回来改变了。

i have a Table Name Tblaccount

i have the followeing Columns
clientID
OrderID
AccountID //Primary Key
AccountReceive
AccountBalance
TotalAccount

i want to add all values of a client AmmountBalce Columns
then desplay in a Gtotalbaltextbox
and also want to know if i minus some amount from GTotaltextbox how to save back the change made .

推荐答案

好吧,你可以简单地做一下

Well, you can simply do
select sum(AccountBalance) from Tblaccount



来得到这笔钱。



但是如果你调整它并想要保存它 - 你需要决定如何做到这一点。毕竟,sum是一个聚合函数(即多对一)。您要编辑每一行,只编辑一行,还是插入调整行?


to get the sum.

But if you adjust it and want to save it back - well you need to decide how to do that. After all, sum is an aggregate function (ie. many-to-one). Are you going to edit each row, just one, or insert an adjustment row?


这篇关于如何在Sql Server中添加列的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆