本帖最后由 lamb218 于 2009-11-17 10:16:56 编辑

解决方案 »

  1.   

    如:
    表:t_title,列:title_name(标题)
    该表数据如下:
    abcdefg1111
    aaabbbccc
    abcdefghij
    eeeeeee
    badeffff
    abcdefgg如果用户输入标题为abcdefgh的数据,就会把abcdefghij这条记录列出来,因为我要的结果是匹配80%的数据
      

  2.   

    一般的匹配规则用LIKE 连续包含匹配,
    还有一种是关键字匹配,
    你要根据字数相同在80%以上?
      

  3.   

    with t_title as 
    ( select 'aaabbbdddf ' title_name from dual
    union all
    select 'aaabbb ' from dual
    union all
    select  'aaabbbbddd' from dual)
    select * from  t_title
    where round(length('aaabbbddd')/length(title_name),1)>=0.8
    and round(length('aaabbbddd')/length(title_name),1)<1
    and  title_name like '%aaabbbddd%'
    试试
    'aaabbbddd'是你新标题
    结果:
    TITLE_NAME
    aaabbbdddf 
      

  4.   


    在这个字段上建个全文索引,然后根据score来查。
      

  5.   

    and  title_name like '%aaabbbddd%'
    这不就是内容????
    内容匹配  并且占原来的80%
    仔细看看,和运行下
      

  6.   

    不过好像比较难做到精确的80%,你输入的标题也不会全是关键字。
    哎,当个思路参考下吧。
    全文检索相关资料:
    http://epub.itpub.net/4/1.htm
      

  7.   

    我还是不能理解这个80%的意思
    就你这个例子来说
    abcdefg1111 
    aaabbbccc 
    abcdefghij 
    eeeeeee 
    badeffff 
    abcdefgg 如果用户输入标题为abcdefgh的数据,就会把abcdefghij这条记录列出来是否要查询出的记录要完全包含abcdefgh这个字符串,然后abcdefgh长度占该记录总长度 的80%以上?abcdefg匹配吗,defghabc匹配吗