SELECT
    detResidImfile.*,
    detRunSummary.data_state
FROM detRunSummary
JOIN detResidImfile
    USING(det_id,iteration)
WHERE
    detRunSummary.data_state = 'goto_cleaned'
AND detResidImfile.data_state = 'full'
