- tried the failed query back at the office, no success? How did I run this?
- new query to update obligations/outlays….
- UPDATE obligations_outlays o1
JOIN obligations_outlays o2
ON o1.funding_id = o2.funding_id AND o1.project_id = o2.project_id
SET o1.month_1 = o1.month_1 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_2 = o1.month_2 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_3 = o1.month_3 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_4 = o1.month_4 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_5 = o1.month_5 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_6 = o1.month_6 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_7 = o1.month_7 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_8 = o1.month_8 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_9 = o1.month_9 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_10 = o1.month_10 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_11 = o1.month_11 + IF(ISNULL(o2.month_12), 0, o2.month_12),
o1.month_12 = o1.month_12 + IF(ISNULL(o2.month_12), 0, o2.month_12),
WHERE o1.type = ‘Outlay $ (Reported in FACTS)’ AND (o1.year + o1.year_count) <= (IF(MONTH(CURDATE()) > 9, YEAR(CURDATE()) + 2, YEAR(CURDATE()) + 1))
AND o1.year_count = 2
AND o2.type = ‘Outlay $ (Reported in FACTS)’ AND o2.year_count = 1
