日期:2014-05-17 浏览次数:20524 次
Quote: 引用: Quote: 引用: 引用yupeigu 我这个还可以弄吗? 是这样吗: create table key_word(word nvarchar(30)) insert into key_word select 'JAVA' union all select 'PHP' union all select 'asp' union all select 'aspx' union all select 'FLEX' go drop table tb go create table tb(id int,content nvarchar(max)) insert into tb select 5 , 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,aspx是动态网页' union all select 6, 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,aspx是动态网页,aspx是动态网页PHP、PHP' union all select 7, 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,aspx是动态网页' go ;with t as ( select id, content, kw.word, dbo.f_searchSTR(tb.content,kw.word) 次数 from tb cross join key_word kw where kw.word in ('asp','aspx','php') group by id,content,kw.word ), tt as ( select --max(次数) over(PARTITION by id) as max_count, min(次数) over(partition by id) as min_count, id,content,word,次数 from t ) select id,content from (
Quote: 引用: 引用yupeigu 我这个还可以弄吗? 是这样吗: create table key_word(word nvarchar(30)) insert into key_word select 'JAVA' union all select 'PHP' union all select 'asp' union all select 'aspx' union all select 'FLEX' go drop table tb go create table tb(id int,content nvarchar(max)) insert into tb select 5 , 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,aspx是动态网页' union all select 6, 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,aspx是动态网页,aspx是动态网页PHP、PHP' union all select 7, 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,aspx是动态网页' go ;with t as ( select id, content, kw.word, dbo.f_searchSTR(tb.content,kw.word) 次数 from tb cross join key_word kw where kw.word in ('asp','aspx','php') group by id,content,kw.word ), tt as ( select --max(次数) over(PARTITION by id) as max_count, min(次数) over(partition by id) as min_count, id,content,word,次数 from t ) select id,content from (
引用yupeigu 我这个还可以弄吗?
yupeigu
create table key_word(word nvarchar(30)) insert into key_word select 'JAVA' union all select 'PHP' union all select 'asp' union all select 'aspx' union all select 'FLEX' go drop table tb go create table tb(id int,content nvarchar(max)) insert into tb select 5 , 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,aspx是动态网页' union all select 6, 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,做网页都不错ASP,aspx是动态网页,aspx是动态网页PHP、PHP' union all select 7, 'ASP,PHP用来做网页都不错ASP,做网页都不错ASP,aspx是动态网页' go ;with t as ( select id, content, kw.word, dbo.f_searchSTR(tb.content,kw.word) 次数 from tb cross join key_word kw where kw.word in ('asp','aspx','php') group by id,content,kw.word ), tt as ( select --max(次数) over(PARTITION by id) as max_count, min(次数) over(partition by id) as min_count, id,content,word,次数 from t ) select id,content from (