SELECT DISTINCT
    detRunSummary.det_id,
    detRunSummary.iteration,
    detRun.filelevel
FROM detRun
JOIN detRunSummary
    USING(det_id)
WHERE
   detRun.state = 'stop'
   AND detRun.mode  = 'master'
   AND detRunSummary.accept = 1
