Query was only being run when using a query alias due to code being
nested too deep.