SELECT DISTINCT
    'fake' as stage,
    fakeRun.fake_id AS stage_id,
    rawExp.exp_name as run_tag,
    distTarget.label,
    distTarget.target_id,
    distTarget.clean
FROM fakeRun
JOIN camRun USING(cam_id)
JOIN chipRun USING(chip_id)
JOIN rawExp USING(exp_id)
JOIN distTarget ON distTarget.stage = 'fake' AND fakeRun.label = distTarget.label
    AND rawExp.filter = distTarget.filter
JOIN rcInterest USING(target_id)
LEFT JOIN distRun ON distRun.stage = 'fake' AND (distRun.stage_id = fake_id)
    AND distRun.clean = distTarget.clean
WHERE  distTarget.state = 'enabled'
    AND rcInterest.state = 'enabled'
    AND distRun.dist_id IS NULL
    AND ((fakeRun.state = 'full') OR (distTarget.clean AND fakeRun.state = 'cleaned'))
