fixed sql when no unique key