fix an error in sql statement