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},'%');

 

posted @ 2022-08-10 23:53  一隅桥畔  阅读(5141)  评论(0)    收藏  举报