select count(distinct Ite_Code) from contentItems left join contentItemsSections as isec on contentItems.Ite_Code=isec.Item WHERE () AND 1=1 AND Str_Code IN (1,2,3) AND Ite_State=0 AND Ite_BDate<='2017-11-24' AND Ite_EDate>='2017-11-24': 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND 1=1 AND Str_Code IN (1,2,3) AND Ite_State=0 AND Ite_BDate<='2017-11-24' AN' at line 1