update tb_UserCount
set i_CNum=(
select COUNT(i_Id)
from tb_Company
where datediff(DAY, tb_UserCount.dt_DateTime, tb_Company.dt_DateTime )=0
and tb_Company.i_uid=tb_UserCount.i_Uid )
where exists(select * from tb_Company where datediff(DAY, tb_UserCount.dt_DateTime, tb_Company.dt_DateTime )=0
and tb_Company.i_uid=tb_UserCount.i_Uid)
set i_CNum=(
select COUNT(i_Id)
from tb_Company
where datediff(DAY, tb_UserCount.dt_DateTime, tb_Company.dt_DateTime )=0
and tb_Company.i_uid=tb_UserCount.i_Uid )
where exists(select * from tb_Company where datediff(DAY, tb_UserCount.dt_DateTime, tb_Company.dt_DateTime )=0
and tb_Company.i_uid=tb_UserCount.i_Uid)