update a set a.入库时间=y.inDate
from 表A as a inner Join (
  select 合同号,min(入库时间) inDate
  from 表B group by 合同号) as y
 on a.合同号=b.合同号