fix:一時テーブル作成時の条件ミスを修理

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 3e6b1ffd0a
commit 7b5821e384

View File

@ -10,7 +10,7 @@ BEGIN
EXECUTE new_history_save_stmt;
-- ②-1 Salesforce側で更新されたデータを検出用一時テーブルの作成
SET @make_history_tmp_create = 'CREATE TEMPORARY TABLE make_history_tmp SELECT id, MIN(@@target_column) AS min_start_datetime, MAX(start_datetime) AS max_start_datetime FROM @@target_table WHERE end_datetime = "9999-12-31 00:00:00" GROUP BY id';
SET @make_history_tmp_create = 'CREATE TEMPORARY TABLE make_history_tmp SELECT id, MIN(@@target_column) AS min_start_datetime, MAX(start_datetime) AS max_start_datetime FROM @@target_table WHERE end_datetime = "9999-12-31 00:00:00" GROUP BY id HAVING count(id) = 2';
SET @make_history_tmp_create = REPLACE(@make_history_tmp_create, "@@target_table", target_table);
SET @make_history_tmp_create = REPLACE(@make_history_tmp_create, "@@target_column", target_column);
PREPARE make_history_tmp_create_stmt from @make_history_tmp_create;