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 camProcessedExp
    ON warpRun.cam_id = camProcessedExp.cam_id
JOIN chipRun
    ON camProcessedExp.chip_id = chipRun.chip_id
JOIN chipProcessedImfile
    ON chipRun.chip_id = chipProcessedImfile.chip_id
JOIN rawExp
    ON chipProcessedImfile.exp_id = rawExp.exp_id
WHERE
    stackRun.state = 'run'
