Edit broken query (missing WITH), tests passing