sql conditions fix about unnecessary brackets