SELECT
    warpRun.warp_id,
    camProcessedExp.cam_id,
    warpRun.workdir,
    rawExp.camera
FROM warpRun
JOIN warpInputExp
    USING(warp_id)
JOIN camProcessedExp
    ON warpInputExp.cam_id = camProcessedExp.cam_id
JOIN chipProcessedExp
    ON camProcessedExp.chip_id = chipProcessedExp.chip_id
JOIN rawExp
    ON chipProcessedExp.exp_tag = rawExp.exp_tag
LEFT JOIN warpSkyCellMap
    ON warpInputExp.warp_id = warpSkyCellMap.warp_id
    AND warpInputExp.cam_id = warpSkyCellMap.cam_id
WHERE
    warpRun.state = 'run'
    AND camProcessedExp.fault = 0
    AND warpSkyCellMap.warp_id IS NULL
    AND warpSkyCellMap.cam_id IS NULL
