日期:2014-05-18  浏览次数:20478 次

怎么查找总和?



我想查找SceneId为1 2 3 的各个ApplyNumber的总和的语句怎么写了?


------解决方案--------------------
select sceneid,sum(applynumber) as applynumber
from tab_name
where sceneid in (1,2,3)
group by sceneid
------解决方案--------------------
SQL code
select SceneId,sum(ApplyNumber) from tb group by SceneId

------解决方案--------------------
SQL code

select SceneId,sum(ApplyNumber) [ApplyNumber_Total]
from Apply
group by SceneId

------解决方案--------------------
SQL code

select sceneid,sum(applynumber)  totalapplynumber from tbl
group by sceneid