读书人

这个查找语句如何写

发布时间: 2012-04-16 16:20:04 作者: rapoo

这个查找语句怎么写?


我想查找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 

读书人网 >SQL Server

热点推荐