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

这个查找语句怎么写?


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

------解决方案--------------------
SQL code
select a.SceneName,isnull(b.s,0) as SumApplyNumber
from SceneInfo a
left join
  (select SceneId,sum(pplyNumber) as s from ApplyInfo group by SceneId) b
on a.SceneId=b.SceneId