update a
set a.Does_receive_data = 1,
a.Receive_data_time = (select max(Setting_time) from from Plan_detail where Plan_id = a.Plan_id)
from Plan a
where not exists (select 1 from Plan_detail
where Plan_id = a.Plan_id and Pda_receive_product_id is null)
------解决方案--------------------