Simple Solution using Joins
\n# Code\nmysql []\nSELECT \n    A.machine_id, \n    ROUND(AVG(B.timestamp - A.timestamp), 3) AS processing_time\nFROM Activity A\nJOIN Activity B \n    ON A.ma
\n# Code\n```mysql []\nSELECT \n    A.machine_id, \n    ROUND(AVG(B.timestamp - A.timestamp), 3) AS processing_time\nFROM Activity A\nJOIN Activity B \n    ON A.machine_id = B.machine_id\n    AND A.process_id = B.process_id\n    AND A.activity_type != B.activity_type\nWHERE A.activity_type = \'start\'\nGROUP BY A.machine_id;\n```
['MySQL']