SELECT DISTINCT
    diffRun.diff_id,
    diffRun.workdir,
    diffRun.skycell_id,
    diffRun.tess_id
FROM diffRun
JOIN diffInputSkyfile
    USING(diff_id)
JOIN warpSkyfile
    ON  diffInputSkyfile.warp_id    = warpSkyfile.warp_id
    AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id
    AND diffInputSkyfile.tess_id    = warpSkyfile.tess_id
LEFT JOIN diffSkyfile
    ON diffInputSkyfile.diff_id = diffSkyfile.diff_id
WHERE
  diffRun.state = 'run'
  AND diffSkyfile.diff_id IS NULL

