高手进来看一下
CREATE proc proc_Zltj
(
@所属 varchar(40),
@开始时间 datetime,
@结束时间 datetime
)
as
begin
select a. BusinessUnitIdName as 所属 ,a.CreatedByName as 负责人, b.[客户更新量], b.[客户增量],c.潜在客户更新量,c.潜在客户增量
from 客户统计人员列表 a inner join
(select 负责人,[客户更新量] = sum(case when 修改时间 between @开始时间 and @结束时间 then 1 else 0 end ),
[客户增量] = sum(case when 添加时间 between @开始时间 and @结束时间 then 1 else 0 end )
from 所有客户 group by 负责人) b on a.CreatedByName=b.负责人
inner join
(select 负责人, [潜在客户更新量] = sum(case when 修改时间 between @开始时间 and @结束时间 then 1 else 0 end ),
[潜在客户增量] = sum(case when 添加时间 between @开始时间 and @结束时间 then 1 else 0 end )
from 所有潜在客户 group by 负责人) c on a.CreatedByName=c.负责人
where BusinessUnitIdName=@所属
end
GO
我想查询的是 @开始时间 与 @结束时间 之前的结果
但现在between 好像不包括@开始时间 与 @结束时间
也就是 between 2007-12-4 and 2007-12-4 是查不出结果的?
什么原因?怎么改?