码迷,mamicode.com
首页 > 其他好文 > 详细

实训--mybatics--之模糊查找-concat

时间:2018-07-18 01:16:52      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:from   name   2017年   ike   mysq   sel   模糊   条件   函数   

mysql 模糊查询 concat()
2017年02月08日 10:27:43
阅读数:15861
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,……….); 连接字符串函数,会生成一个字符串

实训--mybatics--之模糊查找-concat

标签:from   name   2017年   ike   mysq   sel   模糊   条件   函数   

原文地址:https://www.cnblogs.com/czy16/p/9326929.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!