SELECT DISTINCT     -- we use distinct to handle multiple chip runs. Distribution will find right chipRun
    'raw' AS stage,
    rawExp.exp_id AS stage_id,
    rawExp.exp_name AS run_tag,
    distTarget.label,
    distTarget.target_id,
    distTarget.clean
FROM rawExp
JOIN chipRun USING(exp_id)
JOIN distTarget ON distTarget.label = chipRun.label AND distTarget.stage = 'raw'
    AND rawExp.filter = distTarget.filter
JOIN rcInterest USING(target_id)
LEFT JOIN distRun ON distRun.stage = 'raw' AND distRun.stage_id = exp_id
    AND distRun.clean = distTarget.clean
    -- JOIN hook for magicked stuff %s
WHERE distTarget.state = 'enabled'
    AND rcInterest.state = 'enabled'
    AND distRun.dist_id IS NULL      -- no existing distRun

