Moved "where" and "join" before "group"