zoukankan      html  css  js  c++  java
  • 分词匹配并 兼容匹配规则和分页  的SQL语句

    原始表数据
    分词匹配并 <wbr>兼容匹配规则和分页 <wbr> <wbr>的SQL语句
    搜索结果

    分词匹配并 <wbr>兼容匹配规则和分页 <wbr> <wbr>的SQL语句




    排序失效
     (select * from keywords where name like '%中国奶粉%' order by replace(name,'中国奶粉','')) UNION (select * from 
    (select * from keywords where name not like '%中国奶粉%') b where b.name like '%中国%' or b.name like '%奶粉%' ORDER BY b.num desc)

    语句参考

    关键词匹配:

    select *,(case when name like '%中国奶粉%' then (select max(num)+1 from keywords limit 1) else num end) as new_num from keywords where name like '%中国奶粉%' or name like '%奶粉%' or name like '%中国%' order by new_num desc


    商品匹配:

     

    select * from sto_goods where goods_name like '%日本原装花王%' or goods_name like '%日本原装%' ORDER BY REPLACE(goods_name,'日本原装花王','');

    或者根据关键词查询语句修改也可以。




  • 相关阅读:
    OI 知识总览 算法篇 之 动态规划
    LeetCode 16.3Sum Closest
    LeetCode 1.Two sum
    leetCode 15. 3Sum
    leetCode 54. Spiral Matrix
    mybatis(视频)
    mybatis
    spring笔记
    Spring(一)
    Spring(二)
  • 原文地址:https://www.cnblogs.com/linewman/p/9918824.html
Copyright © 2011-2022 走看看