Avoiding add where/having where conditions are null or empty string other minor factoring [ci skip]