你可以使用SQL语句来实现上述的需求。假设你使用的是MySQL数据库,以下是一个示例的SQL语句:
UPDATE table1
INNER JOIN table2 ON table1.batch_id = table2.batch_id
AND table1.file_no = table2.file_no
AND table1.Update_Time <= table2.Update_Time
SET table1.storaGE_LOCATION = 'BDP_TW4';
INSERT INTO table3 (column1, column2, column3, ...)
SELECT column1, column2, column3, ...
FROM table2
WHERE table2.deleted = FALSE
AND NOT EXISTS (
SELECT 1
FROM table1
WHERE table1.batch_id = table2.batch_id
AND table1.file_no = table2.file_no
AND table1.Update_Time <= table2.Update_Time
);
请将以上的table1
、table2
、table3
替换为你的表名,batch_id
、file_no
、Update_Time
、storaGE_LOCATION
等替换为你的字段名。运行以上SQL语句将实现你的需求。
请注意,以上示例是基于MySQL数据库,如果你使用的是其他数据库,可能需要做相应的调整。