当前位置: 代码迷 >> Sql Server >> 这个查找语句如何写
  详细解决方案

这个查找语句如何写

热度:69   发布时间:2016-04-27 13:33:41.0
这个查找语句怎么写?


我想查找ApplyInfo表中每个SceneId中ApplyNumber的总和,但是要显示的是SceneInfo表中SceneName,这个语句怎么写?

------解决方案--------------------
SQL code
select a.SceneName,isnull(b.s,0) as SumApplyNumberfrom SceneInfo aleft join  (select SceneId,sum(pplyNumber) as s from ApplyInfo group by SceneId) bon a.SceneId=b.SceneId
  相关解决方案