我必须更新表“合同”的 10 行和 3 个字段
每 10 行必须用不同的值更新。
update contract_equipment_purchase set date_shipped = (
select lat.tstamp from lease_asset la join CR983_TMP tmp on la.serial_num=tmp.serial join
(select lease_asset_id ,max(tstamp) as tstamp from lease_asset_transaction where status='Placed' group by lease_asset_id)
lat on la.id=lat.lease_asset_id join lease_asset_status las on las.id=la.id and las.status<>'Out of Service' ),
lease_asset_id= (
select la.id from lease_asset la join CR983_TMP tmp on la.serial_num=tmp.serial join
lease_asset_status las on las.id=la.id and las.status<>'Out of Service' ),
comprehensive_expiration_date='2013-10-31'
where id_contract in (
select cep.id_contract from contract_equipment_purchase cep join contract c on cep.id_contract =c.id_contract and c.id_contract_type=10
join facilities f on f.id=c.id_facility
join CR983_TMP crtmp on crtmp.account=f.accounting_id);
我面临的主要问题是所有子查询都会给出多个结果,因为我必须用不同的值更新多行。我怎样才能做到这一点 ?