In example fix sql that is generated from scoping