SELECT
    magic_id,
    exp_id,
    camera,
    magicRun.workdir,
    ra,
    decl,
    tess_id
FROM magicRun
JOIN rawExp USING(exp_id)
LEFT JOIN magicTree
    USING(magic_id)
WHERE
    magicRun.state = 'run'
    AND magicTree.node IS NULL
    AND magicRun.fault = 0
