22,207
社区成员
发帖
与我相关
我的任务
分享
select Numb=100+isnull(sum(isnull(d2.numb,0)),0)
---COALESCE(SUM(d2.numb),0)
---Sum(d2.numb)
from A as d1,B as d2
where d1.id = d2.xh and Finishdate is null
Group By d2.code
Having d2.code = '107-A'
select Numb=100+s.sum_num
from
(
select d2.Numb,isnull(sum(isnull(d2.numb,0)),0) as sum_num
from A as d1,B as d2
where d1.id = d2.xh and Finishdate is null
Group By d2.code
Having d2.code = '107-A'
) s
declare @Numb int
select @Numb=100+
isnull(
(select
sum(isnull(d2.numb,0))
---COALESCE(SUM(d2.numb),0)
---Sum(d2.numb)
from A as d1,B as d2
where d1.id = d2.xh and Finishdate is null
Group By d2.code
Having d2.code = '107-A'
),0)
select @Numb