Update A
Set A.WPS_CHECKINTIME=B.MOP_CHECKOUTTIME
From tblwippcs A,TBLWIPMFGORDEROP B
Where A.wps_order>1 and B.wps_checkintime is null
and A.WPS_LOTUM=B.MOP_LOTNUM
and B.MOP_ORDER=A.WPS_ORDER-1
Set A.WPS_CHECKINTIME=B.MOP_CHECKOUTTIME
From tblwippcs A,TBLWIPMFGORDEROP B
Where A.wps_order>1 and B.wps_checkintime is null
and A.WPS_LOTUM=B.MOP_LOTNUM
and B.MOP_ORDER=A.WPS_ORDER-1
SET a.wps_checkintime =
(SELECT b.mop_checkouttime
FROM tblwipmfgorderop b
WHERE a.wps_order > 1
AND b.wps_checkintime IS NULL
AND a.wps_lotum = b.mop_lotnum
AND b.mop_order = a.wps_order - 1)