fixed repeat sql