SELECT DISTINCT
    detNormalizedStatImfile.*,
    rawExp.camera
FROM detRunSummary
JOIN detNormalizedStatImfile
    USING(det_id,iteration)
JOIN detInputExp
     USING(det_id,iteration)
JOIN rawExp
     USING(exp_id)
WHERE
    ((detRunSummary.data_state = 'goto_cleaned'
      AND detNormalizedStatImfile.data_state = 'full')
     OR (detRunSummary.data_state = 'goto_scrubbed'
      AND detNormalizedStatImfile.data_state = 'full')
     OR (detRunSummary.data_state = 'goto_purged'
      AND detNormalizedStatImfile.data_state = 'full')
     OR detNormalizedStatImfile.data_state = 'goto_cleaned'
     OR detNormalizedStatImfile.data_state = 'goto_scrubbed'
     OR detNormalizedStatImfile.data_state = 'goto_purged')

