Time : 07:52:21 SQLSTATE[42000]: Syntax error or access violation: 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 PARTYID=5710 order by UPDATEDDATE DESC' at line 1 Raw SQL : select count(PARTYID) as totalnew_parties from partydetail as p where NAME!='' and PARTYCODE= and PARTYID=5710 order by UPDATEDDATE DESC