SQL模糊查询like concat
作者:互联网
-- 1、匹配一个字段 比如user_name select * from tb_user where user_name like '%'+ #{keyWord} +'%'; select * from tb_user where user_name like concat('%',#{keyWord},'%');
-- 2、匹配多个字段 根据user_name或user_code查询 select * from tb_user where (user_name like concat('%',#{keyWord},'%')) or (user_code like concat('%',#{keyWord},'%')); select * from tb_user where concat(user_name, user_code) like concat('%',#{keyWord},'%');
标签:name,keyWord,user,SQL,tb,concat,like 来源: https://www.cnblogs.com/sunline/p/16574378.html