zoukankan      html  css  js  c++  java
  • [sql]匹配标题中出现最多关键字的结果

    SELECT RequirementId,Title,ProjectId,Keywords, 0 as keywordcount
    INTO #t1
    FROM
    (
    select *
    from dbo.Requirement
    where Keywords is not null and Keywords <> ''  and ProjectId=11
    and (Keywords like '%关键字1%' or  Keywords like '%关键字2%' or Keywords like '%关键字3%')
    ) AS TEMPTABLE
    select * from #t1 order by keywordcount desc, RequirementID desc
    update #t1
    set keywordcount = keywordcount +1
    where Keywords like '%关键字1%'
    update #t1
    set keywordcount = keywordcount +1
    where Keywords like '%关键字2%'
    update #t1
    set keywordcount = keywordcount +1
    where Keywords like '%关键字3%'
    select * from #t1 order by keywordcount desc, RequirementID desc
    drop table #t1
  • 相关阅读:
    字符串分割并按大小排序
    为人之气
    RMQ
    线段树
    算法中的数学
    动态规划(DP)
    图的表示
    广度优先搜索(BFS)
    深度优先搜索(DFS)
    MyBatis(3.2.3)
  • 原文地址:https://www.cnblogs.com/linn/p/2245348.html
Copyright © 2011-2022 走看看