Try:

update A

set X1 = sum( case when C.Level = 1 then 1 else 0 end ),

X2 = sum( case when C.Level = 2 then 1 else 0 end )

X3 = sum( case when C.Level = 3 then 1 else 0 end )

X4 = sum( case when C.Level = 4 then 1 else 0 end )

from A, B, C

where A.MID = B.MID

and B.PID = C.PID

group by A.MID

update A

set X1 = sum( case when C.Level = 1 then 1 else 0 end ),

X2 = sum( case when C.Level = 2 then 1 else 0 end )

X3 = sum( case when C.Level = 3 then 1 else 0 end )

X4 = sum( case when C.Level = 4 then 1 else 0 end )

from A, B, C

where A.MID = B.MID

and B.PID = C.PID

group by A.MID