震撼人心的句子:asp程序 做完查询后怎么样计算其字段的总和?

来源:百度文库 编辑:神马品牌网 时间:2024/05/01 02:18:49
比方我查询的条件是北京这个城市 然后包括其金额都能列出来 但是我想算出所有北京的金额是多少,就是这个意思!

select sum(a) as a
from table1
where city='北京'

这种情况就可以用SUM加上GROUP BY语句了。就像:
select sum(money) from Table where city='beijin'
and ....(其它条件) group by city
最后,还是建议楼主熟悉一下SQL语句,这对你的网站制作很有帮助。

select sum(a) as a
from table1
where city=北京'