Using Math function and Join || Simple Solution
\n# Code\nmssql []\n/* Write your T-SQL query statement below */\nSELECT \n    start.machine_id,\n    ROUND(AVG(end_activity.timestamp - start.timestamp), 3) AS
\n# Code\n```mssql []\n/* Write your T-SQL query statement below */\nSELECT \n    start.machine_id,\n    ROUND(AVG(end_activity.timestamp - start.timestamp), 3) AS processing_time\nFROM \n    Activity AS start\nJOIN \n    Activity AS end_activity\nON \n    start.machine_id = end_activity.machine_id\n    AND start.process_id = end_activity.process_id\n    AND start.activity_type = \'start\'\n    AND end_activity.activity_type = \'end\'\nGROUP BY \n    start.machine_id;\n\n\n\n```
['Database', 'MS SQL Server']