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