快速模糊查新按照匹配自定义排序,对于提高速度很重要!

快速模糊查新按照匹配自定义排序,对于提高速度很重要!

 

SELECT *
FROM counterss
ORDER BY CASE
WHEN car LIKE '%zhao%qi%yong%'
THEN 0
WHEN car LIKE '%zhao%yong%qi%'
THEN 1
WHEN car LIKE '%yong%zhao%qi%'
THEN 2
WHEN car LIKE '%qi%zhao%yong%'
THEN 3
WHEN car LIKE '%yong%qi%%zhao'
THEN 4
WHEN car LIKE '%qi%yong%zhao%'
THEN 5
WHEN car LIKE '%zhao%'
AND car LIKE '%qi%'
THEN 6
WHEN car LIKE '%zhao%'
AND car LIKE '%yong%'
THEN 7
WHEN car LIKE '%yong%'
AND car LIKE '%qi%'
THEN 8
WHEN car LIKE '%yong%'
THEN 9
WHEN car LIKE '%qi%'
THEN 10
WHEN car LIKE '%zhao%'
THEN 11
END
LIMIT 0 , 30

 

 

结果:

id car fdafds
编辑 删除 1 zhao qi yong 0
编辑 删除 3 zhao qi yong 0
编辑 删除 2 qi yong 0
编辑 删除 4 qi yong 0
编辑 删除 6 yong 0
编辑 删除 5 zhao 0

选中项:

你可能感兴趣的:(自定义)