用VB进行统计
如这组时间数据 时间 ,数字 如把一段时间进行统计 如把12:00到12:59分 相当于把一个小时内数字进行统计,统计到12:00里面去。下面数据等到12:00 ,9 ,超过一个小时数据不管。依次类推。最后按时间顺序依次保存2013-01-28 22:25:00,0.5
2013-01-30 06:55:00,1.5
2013-01-30 09:10:00,5.5
2013-01-30 10:20:00,2.5
2013-01-30 13:10:00,3.5
2013-01-30 13:15:00,6.5
2013-01-30 18:25:00,5.5
2013-01-31 11:45:00,2.5
2013-01-31 12:00:00,5.5
2013-01-31 12:10:00,3.5
2013-01-31 14:20:00,0.5
2013-01-31 14:25:00,4.5
2013-01-31 14:35:00,0.5 --------------------编程问答-------------------- 貌似很简单, --------------------编程问答-------------------- 貌似应该是 little-qiang --------------------编程问答-------------------- 貌似可以用 Partition 关键字查询。用日期时间分段的没有试过,一个数字分段的例子如下(DAO 的,SQL 串同样适用于 ADO):
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = DBEngine.OpenDatabase("C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb")
Set rs = db.OpenRecordset("SELECT DISTINCTROW Partition([freight],0, 500, 50) AS Range, Count(Orders.Freight) As Count From Orders GROUP BY Partition([freight],0,500,50)")
Set Data1.Recordset = rs
结果:
Range Count
0: 49 469
50: 99 174
100:149 70
150:199 44
200:249 25
250:299 13
300:349 4
350:399 11
400:449 3
450:499 4
501: 13
--------------------编程问答-------------------- 如果是设备接收的字符串,我喜欢把数据插入recordset(不插入数据库),直接用filter和sort就能出你要的结果 --------------------编程问答-------------------- 初学者,学习学习
补充:VB , 基础类