本文介绍了如何计算mysql表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张这样的桌子

I am having a table like this

Date          Company Name        Amount
2013-12-11    smevc               500
2013-12-21    smevc               500
2013-12-21    smevc               1000
2013-12-21    smevc               6726
2013-12-21    smevc               8354.40
2013-12-20    smevc               700
2013-12-22    sec                 3736

我需要输出为

I need the output as

COMPNAME    AMT
 Smevc      17780.4
 sec        3536



我该怎么做才能得到输出?


What can i do to get the output?

推荐答案

SELECT [Company Name] AS COMPNAME, SUM(Amount) AS AMT
FROM TableName
GROUP BY [Company Name]


这篇关于如何计算mysql表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 10:07