看了一下,似乎没有必要,用下面这个就满足你的条件了啊
select D.DeptName as [Name],
isnull (count(s.subid),0) as JibanjianNum
from((subdepartment as sd
left outer join service as s on sd.subid=s.subid)
left outer join department as d on sd.deid=d.deid)
where s.typeid=1
and s.useflag='Y'
and s.serviceid not in (select MainSerId from ServiceRelation)
group by D.DeptName
你不就是要统计条件为
s.typeid=1
and s.useflag='Y'
and s.serviceid not in (select MainSerId from ServiceRelation)的吗?
select D.DeptName as [Name],
isnull (count(s.subid),0) as JibanjianNum
from((subdepartment as sd
left outer join service as s on sd.subid=s.subid)
left outer join department as d on sd.deid=d.deid)
where s.typeid=1
and s.useflag='Y'
and s.serviceid not in (select MainSerId from ServiceRelation)
group by D.DeptName
你不就是要统计条件为
s.typeid=1
and s.useflag='Y'
and s.serviceid not in (select MainSerId from ServiceRelation)的吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货