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

