update tb1 inner join
(select type, count(*) as cnt
from tb1 group by type)
as der using(type)
set tb1.cnt = der.cnt

05-11 18:11