Update Join
drop table #DataTable;
CREATE TABLE #DataTable (
requestid BIGINT,TimeType DATETIME
)
insert into #DataTable
select requestid ,max (ActionTimesTamp) as TimeType
from ( SELECT *
FROM [BPM].[dbo].[T_ProcessLog]
where requestid in
( select Objectid
FROM [SmartBox].[dbo].[sobjRequestBase]
where ProcessName ='Ones\NonDBDGeneraSample' and [ApprovedDate] is null and RequestStatus ='approved' ))
T group by requestid
select *from #DataTable
UPDATE so
set so.ApprovedDate =T.TimeType
from [SmartBox].[dbo].[sobjRequestBase] so
inner join #DataTable T
on so.objectid=T.requestid
where so.objectid in
(
select requestid
from ( SELECT *
FROM [BPM].[dbo].[T_ProcessLog]
where requestid in
( select Objectid
FROM [SmartBox].[dbo].[sobjRequestBase]
where ProcessName ='Ones\NonDBDGeneraSample' and [ApprovedDate] is null and RequestStatus ='approved' ))
T group by requestid
)

浙公网安备 33010602011771号