concat() 函数,是用来连接字符串。

精确查询: select * from user where name=”zhangsan” 
模糊查询; select * from user where name like “%zhang%”

在实际的使用中,条件是作为参数传递进来的。 所以我们使用 concat() 函数

mybatis: 
select * from user where name like concat(“%”, #{name},”%”) 

 

原生SQL:

case when ?1 is null then 1=1 else name like CONCAT('%',?1,'%') END 

concat(str1,str2,str3,str4,……….); 连接字符串函数,会生成一个字符串 

 

相关文章:

  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2022-03-08
  • 2021-09-11
  • 2021-10-06
  • 2021-06-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-31
  • 2022-12-23
  • 2023-02-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案