lzzscl,这个SB 2019-04-13 21:23 采纳率: 81.8%
浏览 398
已采纳

mybatis模糊查询时遇见的问题,网上都说这么查,但是我运行起来是错的啊,求救

这是SQL代码,用的时mybatis的注解

 @Select("select * from t_chushou where (title like CONCAT('%',#{0},'%')")

错误信息是:

SQL: select * from t_chushou     WHERE (title like CONCAT("%",?,"%")
### Cause: 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 '' at line 2

我用数据库软件直接运行代码段,发现第一个‘%’后面就好像没用了。。。大神帮我看看呗

图片说明

  • 写回答

5条回答 默认 最新

  • luguo90327 2019-04-16 17:03
    关注

    where (title 这里多了个“(”

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?