数据库拼接字符模糊查询语句(mybatis中运用(xml文件))

   concat:数据库中拼接字符串方法

 distinct :消除重复行

group by:分组排序

方法1;

select distinct function_name,function_module,function_url,date
from agent_function
where
concat('',function_name,function_module) like CONCAT('%',#{_parameter}, '%')

 

方法2;

select distinct function_name,function_module,function_url,date
from agent_function
where function_name LIKE CONCAT(CONCAT('%', #{_parameter}), '%') or
function_module LIKE CONCAT(CONCAT('%', #{_parameter}), '%')

posted @ 2017-03-01 17:33  Ming明  阅读(3512)  评论(0编辑  收藏  举报