concat() 函数,是用来连接字符串。
精确查询: select * from user where name=”zhangsan”
模糊查询; select * from user where name like “%zhang%”
在实际的使用中,条件是作为参数传递进来的。 所以我们使用 concat() 函数
mybatis:
select * from user where name like concat(“%”, #{name},”%”)
concat(str1,str2,str3,str4,……….); 连接字符串函数,会生成一个字符串
本文介绍了如何在SQL查询中使用concat()函数进行模糊匹配,特别是在MyBatis框架中,通过动态SQL实现对用户姓名的模糊搜索,提高了查询的灵活性和效率。
928

被折叠的 条评论
为什么被折叠?



