Time : 02:09:17 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 AUTOVOUCHERNO like '210318%' order by AUTOVOUCHERNO desc limit 1' at line 1 Raw SQL : select AUTOVOUCHERNO from mastertransaction where ACCOUNTVOUCHERTYPEID= and AUTOVOUCHERNO like '210318%' order by AUTOVOUCHERNO desc limit 1