diff --git a/database/repair_monthly_scores.sql b/database/repair_monthly_scores.sql index 7510723..a559c2f 100644 --- a/database/repair_monthly_scores.sql +++ b/database/repair_monthly_scores.sql @@ -46,7 +46,7 @@ INSERT INTO dept_monthly_score SELECT e.dept_id, dept.dept_name, @year, @month, e.earned_score, 0, e.earned_score, e.completed_task_count, 0, 0, NOW(), NOW() FROM tmp_monthly_earned e -JOIN department dept ON dept.id = e.dept_id +JOIN sys_dept dept ON dept.id = e.dept_id LEFT JOIN dept_monthly_score d ON d.dept_id = e.dept_id AND d.year = @year AND d.month = @month WHERE d.id IS NULL;