这样对么
update data_m3235_temp b1
set psid= (select newpsid from (select t1.pid,t1.midsideid,max(t3.psid) newpsid
from data_m3235_temp t1,(select a1.pid,a1.midsideid from data_m3235_temp a1,bsc_productspec a2 where a1.outtime is not null
and a1.pstatus = 3 and a2.cid =3235 and a1.psid=a2.psid and a1.pid<>a2.pid ) t2,
odr_outlist t3,bsc_productspec t4
where
t1.pid=t2.pid and t1.midsideid=t2.midsideid and t1.outno=t3.billnum and t3.psid=t4.psid and t1.pid = t4.pid
and t3.cid=3235 and t4.cid=3235 group by t1.pid,t1.midsideid ) b2
where b1.pid=b2.pid and b1.midsideid=b2.midsideid)
where exists(select 1 from (select t1.pid,t1.midsideid,max(t3.psid) newpsid
from data_m3235_temp t1,(select a1.pid,a1.midsideid from data_m3235_temp a1,bsc_productspec a2 where a1.outtime is not null
and a1.pstatus = 3 and a2.cid =3235 and a1.psid=a2.psid and a1.pid<>a2.pid ) t2,
odr_outlist t3,bsc_productspec t4
where
t1.pid=t2.pid and t1.midsideid=t2.midsideid and t1.outno=t3.billnum and t3.psid=t4.psid and t1.pid = t4.pid
and t3.cid=3235 and t4.cid=3235 group by t1.pid,t1.midsideid ));