create table ta(num int, win varchar(100))
insert ta select '2005001', '01 02 06 34 11 32 08'
union all select '2005002', '03 02 06 34 11 32 08'
union all select '2005003', '22 34 12 32 09 07 23'
union all select '2005004', '20 21 34 33 09 08 06'
union all select '2005005', '05 08 23 11 14 33 35'
--查询
select id=identity(int) into #tt from syscolumns
select wincode, times=count(1)
from (
select num, wincode=substring(win, id, 2)
from ta, #tt
where id<=len(win)
and substring(' '+win, id, 1)=' ' )t
group by wincode--清除
drop table #tt
drop table ta
insert ta select '2005001', '01 02 06 34 11 32 08'
union all select '2005002', '03 02 06 34 11 32 08'
union all select '2005003', '22 34 12 32 09 07 23'
union all select '2005004', '20 21 34 33 09 08 06'
union all select '2005005', '05 08 23 11 14 33 35'
--查询
select id=identity(int) into #tt from syscolumns
select wincode, times=count(1)
from (
select num, wincode=substring(win, id, 2)
from ta, #tt
where id<=len(win)
and substring(' '+win, id, 1)=' ' )t
group by wincode--清除
drop table #tt
drop table ta
没太看懂
-.-程序这行 真的需要天分的
create table ta(num int, win varchar(100))
insert ta select '2005001', '01 02 06 34 11 32 08'
union all select '2005002', '03 02 06 34 11 32 08'
union all select '2005003', '22 34 12 32 09 07 23'
union all select '2005004', '20 21 34 33 09 08 06'
union all select '2005005', '05 08 23 11 14 33 35'
--查询
select id=identity(int) into #tt from syscolumns
select top 5 *
from(
select wincode, times=count(1)
from (
select num, wincode=substring(win, id, 2)
from ta, #tt
where id<=len(win)
and substring(' '+win, id, 1)=' ' )t
group by wincode
)tt
order by times desc--清除
drop table #tt
drop table ta