作者 tangxvhui

更新数据脚本

... ... @@ -75,3 +75,28 @@ SET
WHERE
id IN (18404, 18458);
--
WITH t1 AS (
SELECT
summary_evaluation_value.evaluation_item_id,
summary_evaluation_value.value,
summary_evaluation_value.id AS value_id,
summary_evaluation_value.score,
summary_evaluation.company_id
FROM
summary_evaluation_value
JOIN summary_evaluation ON summary_evaluation_value.summary_evaluation_id = summary_evaluation.id
WHERE
summary_evaluation_value.value = summary_evaluation_value.score
AND summary_evaluation."types" = 1
ORDER BY
summary_evaluation_value.created_at
)
SELECT
t1.value_id,
cast(evaluation_item_used.weight AS float) AS weight,
cast(t1.value AS float) AS value,
cast(t1.value AS float) * cast(evaluation_item_used.weight AS float) AS real_value
FROM
evaluation_item_used
JOIN t1 ON t1.evaluation_item_id = evaluation_item_used.id
... ...