SELECT
    staticskyResult.*,
    staticskyRun.state,
    staticskyRun.workdir,
    staticskyRun.label,
    stackRun.tess_id,
    stackRun.skycell_id,
    count(stackRun.filter) AS num_filters,
    skycell.glong,
    skycell.glat
FROM staticskyRun
JOIN staticskyResult USING(sky_id)
JOIN staticskyInput USING(sky_id)
JOIN stackRun USING(stack_id)
LEFT JOIN skycell USING(tess_id, skycell_id)
