txt数据库字段中记录了N条数据,每个条记录都是记录的数字,用|分隔的。大家帮我看看怎么统计到这些记录中都有哪些数字,(排除重复的),并且如果有重复的,读取它重复过多少次。请大家指点,谢谢。
细心的高手最好能为我提供C#代码,谢谢了,在线等。
解决方案 »
- 如何编写数据采集器(C#)
- 我要做一个搜索的功能,关于gridview 怎么去绑定数据
- 推荐深入学习asp.net的好书...
- asp.net 判断字符串编码格式并转换为GB2312
- 菜鸟求个页面思路设计问题,在线等
- (解决就给分)文件下载的超级怪现象!!!本机运行没问题,别人访问我就返回登录页面。
- 关于一个xml的小问题,在线
- 弱弱的问一个dataset问题!
- 求助:ASP Net - 1.1 to 2.0 conversion遇到的问题
- 新年上班第一天 祝大家新年进步 并祝自己又获一个角(可是一分一分辛苦得来的)!!!
- asp.net中怎样在datagrid控件中显示出表中的内容,除了手动绑定数据源以外
- 如何用原文件名称另存服务器上的doc文件
insert into txttable
select 3,1,5,null,null union all
select 1,10,20,30,40 union all
select 12,43,45,null,null union all
select 10,34,null,null,null union all
select 12,68,null,null,null union all
select 45,17,36,null,null union all
select 12,36,89,55,69 union all
select 45,69,56,33,20 union all
select 45,40,58,25,17
go
create function [dbo].[f_GetCount]
(
@s int
)
returns int
as
begin
declare @i intselect @i=count(1) from txttable where col=@s
select @i=@i+count(1) from txttable where col2=@s
select @i=@i+count(1) from txttable where col3=@s
select @i=@i+count(1) from txttable where col4=@s
select @i=@i+count(1) from txttable where col5=@s
return @i
end goselect col as 数字,dbo.[f_GetCount](col) as 个数 from (
select col from txttable union
select col2 from txttable union
select col3 from txttable union
select col4 from txttable union
select col5 from txttable )
a where col is not null/*
数字 个数
----------- -----------
1 2
3 1
5 1
10 2
12 3
17 2
20 2
25 1
30 1
33 1
34 1
36 2
40 2
43 1
45 4
55 1
56 1
58 1
68 1
69 2
89 1
*/