100求救如何提取关键词······················
已知:
表明:Test
字段:BusinessScope
类型:nvarchar
大小:100
+++++++++++++++++++++++++++++++++++++++++++++++
现在表Test中有500万条记录,我现在想从字段BusinessScope提取出次数出现最多的100个关键字出来,请问各位高手有没有好的方法,谢谢!
问题点数:100、回复次数:10Top
1 楼wangtiecheng(不知不为过,不学就是错!)回复于 2006-03-20 12:05:32 得分 40
create table #t(BusinessScope nvarchar(100))
go
insert into #t(BusinessScope) values('a')
insert into #t(BusinessScope) values('b')
insert into #t(BusinessScope) values('c')
insert into #t(BusinessScope) values('a')
insert into #t(BusinessScope) values('b')
insert into #t(BusinessScope) values('c')
insert into #t(BusinessScope) values('b')
select top 100 BusinessScope,count(*) 次数
from #t with (nolock)
group by BusinessScope
order by count(*) desc,BusinessScope
drop table #t
goTop
2 楼zjcxc(邹建)回复于 2006-03-20 12:06:38 得分 0
select top 1000
BusinessScope
from test
group by BusinessScope
order by count(*) descTop
3 楼zjcxc(邹建)回复于 2006-03-20 12:06:53 得分 30
select top 100
BusinessScope
from test
group by BusinessScope
order by count(*) desc
Top
4 楼aniude(重返荣耀)回复于 2006-03-20 12:40:02 得分 10
select top 100 BusinessScope from Test group by BusinessScope order by Count(BusinesssScope)Top
5 楼gaojier1000(V2※高捷)回复于 2006-03-20 12:52:19 得分 10
select top 1000
BusinessScope
from test
group by BusinessScope
order by Count(BusinesssScope)
Top
6 楼airfont(草原劣马)回复于 2006-03-20 12:57:00 得分 10
select top 100 BusinessScope from test group by BusinessScope order by
count(BusinesssScope) desc
要先进行分组再进行统计按倒序进行排序才能取出最大的来Top
7 楼JieDa(JieDa)回复于 2006-03-20 14:03:27 得分 0
楼上几位兄弟的方法很好,
问题是关键字怎么抽取出来,
比如我只要抽取频繁出现的2个中文字符即可,这样怎么来取Top
8 楼JieDa(JieDa)回复于 2006-03-20 14:05:17 得分 0
select top 100
left(BusinessScope,2)
from BeiJing
group by left(BusinessScope,2)
order by count(*) desc
这样就可以呵呵Top
9 楼JieDa(JieDa)回复于 2006-03-20 14:06:25 得分 0
select top 100 left(BusinessScope,2),count(*) 次数
from BeiJing with (nolock)
group by left(BusinessScope,2)
order by count(*) desc,left(BusinessScope,2)
也可以呵呵Top
10 楼geniusli(纠级天使)回复于 2006-03-20 14:07:53 得分 0
select top 100 BusinessScope from test group by BusinessScope order by count(*) descTop




