rewrite sql with outer joins when stations are missing