insert into @tab1 select count(*)from checkview group by checktypename ,checktype,checkdate,checkid having checktype='值次' and @checktime=cast(substring(cast(checkdate as nvarchar(20)),1,10) as datetime) and checkid=@checkid insert into @tab1 select count(*)from chec