Mysql 获取模糊,根据模糊查询匹配度大小排序

 

方法一:

根据匹配结果的长短排序

select * from audit_manage_pro where pro_name LIKE '%集成电路%' ORDER BY ABS(LENGTH(pro_name)-LENGTH('集成电路'))

Mysql 获取模糊,根据模糊查询匹配度大小排序_第1张图片

方法二:

select * from audit_manage_pro where pro_name LIKE '%集成电路%' ORDER BY LOCATE('集成电路',pro_name)

 

方法三:

select * from audit_manage_pro where pro_name LIKE '%集成电路%' ORDER BY REPLACE(pro_name,'集成电路','')

 

你可能感兴趣的:(MySql)