SELECT t1.exam_id, t1.duration, t1.release_time from( select t.exam_id, t.duration, t.release_time, sum(case when t.m=2 then diff when t.d=2 then -diff else 0 end) as p from ( select e2.exam_id, e2.duration, e2.release_time, timestampd...