Merge pull request #122 feature-NEWDWH2021-795 into develop-6crm

This commit is contained in:
朝倉 明日香 2022-10-24 10:17:06 +09:00
commit 6cf4130291
2 changed files with 6 additions and 6 deletions

View File

@ -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$$
)
';

View File

@ -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