Remove unnecessary sql condition.