mysql中的总和

时间:2017-05-23 10:18:25

标签: mysql

我想要总和值的总和,下面的查询给出(7月+ 8月+ 9月)总和

SELECT  `ls_no`,
        `core`,
        `domain`, 
        `Prog_StdName`,
        sum(Jul+Aug+Sep) as total 
FROM `cf_1ls` 
 WHERE `ls_no`='1234' 
  AND `SOF`='1001' 
 GROUP BY domain ORDER BY `id`;

现在我需要查询来获得总和的总和

1 个答案:

答案 0 :(得分:1)

如果您想要总和,可以省略group by

SELECT sum(Jul+Aug+Sep) as total 
 FROM cf_1ls
WHERE ls_no='1234' 
 AND SOF='1001'