SELECT DISTINCT
    warpSkyfile.*,
    rawExp.camera
FROM stackRun
JOIN stackInputSkyfile
    USING(stack_id)
JOIN warpSkyfile
    ON  stackInputSkyfile.warp_id = warpSkyfile.warp_id
    AND stackRun.skycell_id       = warpSkyfile.skycell_id
    AND stackRun.tess_id          = warpSkyfile.tess_id
JOIN warpRun
    ON stackInputSkyfile.warp_id = warpRun.warp_id
JOIN fakeRun
    USING(fake_id)
JOIN camRun
    USING(cam_id)
JOIN chipRun
    USING(chip_id)
JOIN chipProcessedImfile
    USING(chip_id)
JOIN rawExp
    ON chipProcessedImfile.exp_id = rawExp.exp_id
WHERE
    stackRun.state = 'run'
