From cc1d234d290717dc9a7c7e619d1b821b118b1a30 Mon Sep 17 00:00:00 2001 From: "shimoda.m@nds-tyo.co.jp" Date: Fri, 21 Oct 2022 18:55:27 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=83=86=E3=83=BC=E3=83=96=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E3=82=AB=E3=83=A9=E3=83=A0ID=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=81=AB=E4=BC=B4=E3=81=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rds_mysql/stored_procedure/crm_data_sync.sql | 4 ++-- rds_mysql/stored_procedure/crm_history.sql | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rds_mysql/stored_procedure/crm_data_sync.sql b/rds_mysql/stored_procedure/crm_data_sync.sql index f04b6f8b..bf77e61a 100644 --- a/rds_mysql/stored_procedure/crm_data_sync.sql +++ b/rds_mysql/stored_procedure/crm_data_sync.sql @@ -28,11 +28,11 @@ BEGIN tt.end_datetime = "9999-12-31 00:00:00" AND NOT EXISTS ( SELECT - tta.id + tta.Id FROM $$target_table_all$$ tta WHERE - tt.id = tta.id + tt.Id = tta.Id AND tt.$$target_column$$ = tta.$$target_column$$ ) '; diff --git a/rds_mysql/stored_procedure/crm_history.sql b/rds_mysql/stored_procedure/crm_history.sql index 1b59cb7a..645cdfa4 100644 --- a/rds_mysql/stored_procedure/crm_history.sql +++ b/rds_mysql/stored_procedure/crm_history.sql @@ -49,7 +49,7 @@ BEGIN SET @make_history_tmp_create = ' CREATE TEMPORARY TABLE $$target_table$$_make_history_tmp SELECT - id + Id , MIN($$target_column$$) AS min_start_datetime , MAX(start_datetime) AS max_start_datetime FROM @@ -57,9 +57,9 @@ BEGIN WHERE end_datetime = "9999-12-31 00:00:00" GROUP BY - id + Id HAVING - count(id) = 2 + 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); @@ -71,7 +71,7 @@ BEGIN SET @update_end_datetime = ' UPDATE $$target_table$$ tt INNER JOIN $$target_table$$_make_history_tmp mht - ON tt.id = mht.id + ON tt.Id = mht.Id AND tt.start_datetime = mht.min_start_datetime SET end_datetime = mht.max_start_datetime - INTERVAL 1 SECOND