-- need to restrict to a single detRunSummary (require all to say 'cleaned'?)
SELECT
    detProcessedExp.*,
    rawExp.camera
FROM detRunSummary
JOIN detProcessedExp
    USING(det_id)
JOIN rawExp
     USING(exp_id)
WHERE
    ((detRunSummary.data_state = 'goto_cleaned'
      AND detProcessedExp.data_state = 'full')
     OR (detRunSummary.data_state = 'goto_scrubbed'
         AND detProcessedExp.data_state = 'full')
     OR (detRunSummary.data_state = 'goto_purged'
         AND detProcessedExp.data_state = 'full')
     OR detProcessedExp.data_state = 'goto_cleaned'
     OR detProcessedExp.data_state = 'goto_scrubbed'
     OR detProcessedExp.data_state = 'goto_purged')
