[MySQL] CASE WHEN
\n\nSELECT \n    machine_id, \n    ROUND(SUM(CASE WHEN activity_type = "end" THEN timestamp ELSE -timestamp END)/COUNT(DISTINCT process_id), 3) AS processing_ti
\n```\nSELECT \n    machine_id, \n    ROUND(SUM(CASE WHEN activity_type = "end" THEN timestamp ELSE -timestamp END)/COUNT(DISTINCT process_id), 3) AS processing_time\nFROM Activity\nGROUP BY 1\n```
['MySQL']