帶有like的拼接出錯
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'description like '%''erer''%'' at line 1 怎么拼接的時候會出現這個錯呢
2016-07-26
SELECT ID,COMMAND,DESCRIPTION,CONTENT FROM message WHERE 1=1 AND DESCRIPTION LIKE '%' ? '%';
sql.append(" and DESCRIPTION like '%' ? '%'");
正確拼接
2016-09-11
我也是這個問題 你怎么解決的