Start Processing : 2025-06-14 12:33:16
0 rows affectedUPDATE db_opportunity_stage_change SET _lastModifiedDT= STR_TO_DATE(_lastModified, '%m/%d/%Y')
[5] 0 seconds -> -1 rows affected
UPDATE db_opportunity_stage_change SET _closeDT=STR_TO_DATE(_closeDate,'%m/%d/%Y')
[10] 0 seconds -> -1 rows affected
INSERT INTO db_opportunity_phase (_opportunityID, _opportunityName, _currentStage, _createdDT, _closeDT)
SELECT DISTINCT a._opportunityID, a._opportunityName, b._stage, b._createdDT, b._closeDT FROM db_opportunity_stage_change a,
db_all_opportunity b
WHERE a._opportunityID = b._opportunityID
ON DUPLICATE KEY UPDATE _currentStage = _stage, _createdDT = b._createdDT, _closeDT = b._closeDT
[10] 1.19 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '5.0 Closed Won' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became50DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[20] 0.25 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = 'Closed Lost' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._becameClosedLost = b._changeDT
WHERE a._opportunityID = b._opportunityID
[21] 0.31 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '4.5 Contracting' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became45DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[22] 0.27 seconds -> 0 rows affected
UPDATE db_opportunity_phase SET _became45DT = IF(_became45DT IS NULL AND _became50DT IS NOT NULL,_became50DT,_became45DT)
[23] 0.01 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '4.0 Verbal Award' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became40DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[24] 0.28 seconds -> 0 rows affected
UPDATE db_opportunity_phase SET _became40DT = IF(_became40DT IS NULL AND _became45DT IS NOT NULL,_became45DT,_became40DT)
[25] 0.05 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '3.5 Post Finalist' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became35DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[26] 0.34 seconds -> 0 rows affected
UPDATE db_opportunity_phase SET _became35DT = IF(_became35DT IS NULL AND _became40DT IS NOT NULL,_became40DT,_became35DT)
[27] 0.04 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '3.0 Finalist' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became30DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[28] 0.29 seconds -> 0 rows affected
UPDATE db_opportunity_phase SET _became30DT = IF(_became30DT IS NULL AND _became35DT IS NOT NULL,_became35DT,_became30DT)
[29] 0.05 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '2.5 Post Proposal' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became25DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[30] 0.28 seconds -> 0 rows affected
UPDATE db_opportunity_phase SET _became25DT = IF(_became25DT IS NULL AND _became30DT IS NOT NULL,_became30DT,_became25DT)
[31] 0.04 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '2.0 Proposal' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became20DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[32] 0.27 seconds -> 0 rows affected
UPDATE db_opportunity_phase SET _became20DT = IF(_became20DT IS NULL AND _became25DT IS NOT NULL,_became25DT,_became20DT)
[33] 0.04 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '1.5 Qualified' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became15DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[34] 0.36 seconds -> 0 rows affected
UPDATE db_opportunity_phase SET _became15DT = IF(_became15DT IS NULL AND _became20DT IS NOT NULL,_became20DT,_became15DT)
[35] 0.05 seconds -> 0 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID, _toStage, MIN(_lastModifiedDT) _changeDT FROM db_opportunity_stage_change WHERE _toStage = '1.0 Non-Qualified' AND _fromStage != _toStage GROUP BY 1,2) b
ON a._opportunityID = b._opportunityID
SET a._became10DT = b._changeDT
WHERE a._opportunityID = b._opportunityID
[36] 0.27 seconds -> 0 rows affected
UPDATE db_opportunity_phase SET _movedBackward = 0
[40] 0.09 seconds -> 98 rows affected
UPDATE db_opportunity_phase a INNER JOIN
(SELECT _opportunityID FROM db_opportunity_phase
WHERE (_became10DT IS NOT NULL AND _became10DT > _became15DT AND _currentStage REGEXP '1.|2.|3.|4.')
OR _became15DT > _became20DT
OR _became20DT > _became25DT
OR _became25DT > _became30DT
OR _became30DT > _became35DT
OR _became35DT > _became40DT
OR _became40DT > _became45DT) b
ON a._opportunityID = b._opportunityID
SET _movedBackward = 1 WHERE a._opportunityID = b._opportunityID
[41] 0.04 seconds -> 98 rows affected
UPDATE db_opportunity_phase SET _closedOrNot = 1 WHERE _became50DT IS NOT NULL OR _becameClosedLost IS NOT NULL
[50] 0 seconds -> 0 rows affected