SELECT DISTINCT
    warpSkyCellMap.warp_id,
    warpSkyCellMap.skycell_id,
    warpSkyCellMap.tess_id,
    warpSkyCellMap.cam_id,
    rawExp.camera,
    warpRun.workdir
FROM warpRun
JOIN warpSkyCellMap
    USING(warp_id)
JOIN camProcessedExp
    ON warpSkyCellMap.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 warpSkyfile
    ON warpRun.warp_id = warpSkyfile.warp_id
    AND warpSkyCellMap.skycell_id = warpSkyfile.skycell_id
    AND warpSkyCellMap.tess_id = warpSkyfile.tess_id
WHERE
    warpRun.state = 'run'
    AND warpSkyfile.warp_id IS NULL
    AND warpSkyfile.skycell_id IS NULL
    AND warpSkyfile.tess_id IS NULL

