refactor:②-2内部結合に変更しWhere条件削除

This commit is contained in:
y-ono-r 2022-08-01 20:02:29 +09:00 committed by shimoda.m@nds-tyo.co.jp
parent 5d7962af70
commit 99a97658b4

View File

@ -70,15 +70,13 @@ BEGIN
-- ②-2 「②-1」で取得した全件に更新処理を行う
SET @update_end_datetime = '
UPDATE $$target_table$$ tt
LEFT JOIN $$target_table$$_make_history_tmp mht
JOIN $$target_table$$_make_history_tmp mht
ON tt.id = mht.id
AND tt.start_datetime = mht.min_start_datetime
SET
end_datetime = mht.max_start_datetime - INTERVAL 1 SECOND
, upd_user = CURRENT_USER()
, upd_date = CURRENT_TIMESTAMP()
WHERE
mht.id IS NOT NULL
';
SET @update_end_datetime = REPLACE(@update_end_datetime, "$$target_table$$", target_table);
SET @update_end_datetime = REPLACE(@update_end_datetime, "$$target_column$$", target_column);