update A set 已住人数=b.cc from sushe A,(select 宿舍号,count(*) cc from cw group by 宿舍号) B where a.宿舍号=b.宿舍号