It is the subquery in the WHERE clause that is causing the problem.
First run this query to see if the results look like what you want them to beSELECT
DATEADD(DAY,DATEDIFF(DAY,0,Start_time),0) AS Date,
COUNT(*) AS count_for_XYZ
FROM
TableB;
If that looks right, you can do the updates by making that into a subquery like shown below:UPDATE a SET
a.count_for_XYZ = b.count_for_XYZ
FROM
TableA a
INNER JOIN
(
SELECT
DATEADD(DAY,DATEDIFF(DAY,0,x.Start_time),0) AS Date,
COUNT(*) AS count_for_XYZ
FROM
TableB x
) AS b ON b.Date = a.Date
That assumes taht the Date column in TableA has no time portion to it.