Mysql
 sql >> Database >  >> RDS >> Mysql

Differenza di data tra due record nella stessa tabella

SELECT j1.job_id AS job_id, (j2.created_at - j1.created_at) AS time_run
FROM job_logs j1 INNER JOIN job_logs j2 ON (j1.job_id = j2.job_id)
WHERE j1.status = 'started' AND j2.status = 'completed'