IF EXISTS(SELECT * FROM sysobjects WHERE id = object_id(N'View_DataNodeByDate') AND OBJECTPROPERTY(id, N'IsView') = 1) DROP View [View_DataNodeByDate] GO create VIEW [dbo].[View_DataNodeByDate] AS --select count(hisexamno) as ApplyCount,substring(convert(char(10) ,t.createdate , 21),1,10) from [dbo].[HISAPPLICATIONFORM] t --where t.createdate >='2022-03-19 00:00:00' --group by substring(convert(char(10) ,t.createdate , 21),1,10) -------------------------开单数量-------------------------------- select a.DisplayTime, count(b.createdate) as ApplyCount from TempDataNodeTime a left join HISAPPLICATIONFORM b on substring(convert(char(10) ,b.createdate, 21),1,10)=a.DisplayTime group by a.[DisplayTime] -------------------------预约数量-------------------------------- select a.DisplayTime, count(b.OperateTime) as AppointCount from TempDataNodeTime a left join TableAppointmentMainInfo b on substring(convert(char(10) ,b.InsertDate, 21),1,10)=a.DisplayTime group by a.[DisplayTime] -------------------------签到数量-------------------------------- select a.DisplayTime, count(b.Enrollodate) as SignCount from TempDataNodeTime a left join TableSignInInfo b on substring(convert(char(10) ,b.Enrollodate, 21),1,10)=a.DisplayTime group by a.[DisplayTime] -------------------------陪检分配数量-------------------------------- select a.DisplayTime, count(b.AllotTime) as AllotCount from TempDataNodeTime a left join AccompanyInfo b on substring(convert(char(10) ,b.AllotTime, 21),1,10)=a.DisplayTime group by a.[DisplayTime] GO select a.DisplayTime, count(b.createdate) as ApplyCount, count(c.InsertDate) as AppointCount, count(d.Enrollodate) as SignCount, count(e.AllotTime) as AllotCount from TempDataNodeTime a left join HISAPPLICATIONFORM b on substring(convert(char(10) ,b.createdate, 21),1,10)=a.DisplayTime left join TableAppointmentMainInfo c on substring(convert(char(10) ,c.InsertDate, 21),1,10)=a.DisplayTime left join TableSignInInfo d on substring(convert(char(10) ,d.Enrollodate, 21),1,10)=a.DisplayTime left join AccompanyInfo e on substring(convert(char(10) ,e.AllotTime, 21),1,10)=a.DisplayTime group by a.[DisplayTime]
博客内容主要用于日常学习记录,内容比较随意,如有问题,还需谅解!!!