Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在mysql中获取列的和_Php_Mysql_Sql_Identity Column - Fatal编程技术网

Php 在mysql中获取列的和

Php 在mysql中获取列的和,php,mysql,sql,identity-column,Php,Mysql,Sql,Identity Column,我使用的是用户Keevas的例子,但问的是另一个问题 select Master_Code, SUM(Jan), SUM(Feb), SUM(Mar) from dbo.foobar WHERE Participating_City = 'foofoo' GROUP BY Master_Code ORDER BY Master_Code ASC 大概是这样的: Master_Code sum(Jan) Sum(Feb) sum(Mar) Total 1 4

我使用的是用户Keevas的例子,但问的是另一个问题

select Master_Code, SUM(Jan), SUM(Feb), SUM(Mar)
 from dbo.foobar
WHERE Participating_City = 'foofoo'
GROUP BY Master_Code ORDER BY Master_Code ASC
大概是这样的:

Master_Code sum(Jan) Sum(Feb) sum(Mar)  Total
        1     4         5       4        13
        2     5         5       5        15

如何获取总值列

阅读有关
SUM()
groupby
的内容,您可以在此链接上查阅:
SELECT username,SUM(value) AS SumValue FROM
 table GROUP BY username ORDER BY SumValue DESC