begin
DECLARE @CreateTime datetime,@EndTime datetime
SET @CreateTime= Convert(varchar(10),getdate()-7,120)
SET @EndTime=Convert(varchar(10),getdate(),120)
select b.[date],COUNT(a.UserID_int) as 人数
from ( select convert(varchar(10),dateadd(day,number,@CreateTime),120) as [date]
from master..spt_values
where datediff(day,dateadd(day,number,@CreateTime), @EndTime)>=0
and number>=0
and type='p') as b left join OED_User as a on convert(varchar(10),a.CreateTime_datetime,120)=b.[date] and ISNULL(a.IsEnable_bit,0)=1
group by b.[date]
order by b.[date]
end
DECLARE @CreateTime datetime,@EndTime datetime
SET @CreateTime= Convert(varchar(10),getdate()-7,120)
SET @EndTime=Convert(varchar(10),getdate(),120)
select b.[date],COUNT(a.UserID_int) as 人数
from ( select convert(varchar(10),dateadd(day,number,@CreateTime),120) as [date]
from master..spt_values
where datediff(day,dateadd(day,number,@CreateTime), @EndTime)>=0
and number>=0
and type='p') as b left join OED_User as a on convert(varchar(10),a.CreateTime_datetime,120)=b.[date] and ISNULL(a.IsEnable_bit,0)=1
group by b.[date]
order by b.[date]
end