ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 552|回复: 0

时间段内然后按照间隔时间来查询数据出错啦

[复制链接]

TA的精华主题

TA的得分主题

发表于 2017-12-22 21:17 | 显示全部楼层 |阅读模式
本帖最后由 ly_16 于 2017-12-22 21:26 编辑

我想在一个时间段内然后按照间隔时间来查询数据
Sql = "select * from Float_Tag  where 时间 between  '" & CDate(StartDate) & "' and  '" & CDate(StopDate) & "'And DateDiff( mi, + '" & CDate(StartDate) & "',时间) % " + "60" + "=0 "
其中StartDate和StopDate是DTPicker1控件,时间格式 2013-09-26 17:53:00,间隔时间选择"mi" 及“60”即60分钟,原本查询出来数据是:
2013-09-26 17:53:00
2013-09-26 18:53:00
2013-09-26 19:53:00
2013-09-26 20:53:00
2013-09-26 21:53:00
为什么查询出来数据是以下内容,多出类似2013-09-26 17:53:00与2013-09-26 18:53:00数据?
2013-09-26 17:53:00
2013-09-26 17:53:01
2013-09-26 17:53:02
2013-09-26 17:53:03
2013-09-26 17:53:04
2013-09-26 17:53:05
2013-09-26 17:53:06
2013-09-26 17:53:07
2013-09-26 17:53:08
2013-09-26 17:53:09
2013-09-26 17:53:10
2013-09-26 17:53:11
2013-09-26 17:53:12
2013-09-26 17:53:13
2013-09-26 17:53:14
2013-09-26 17:53:15
2013-09-26 17:53:16
2013-09-26 17:53:17
2013-09-26 17:53:18
2013-09-26 17:53:19
2013-09-26 17:53:20
2013-09-26 17:53:21
2013-09-26 17:53:22
2013-09-26 17:53:23
2013-09-26 17:53:24
2013-09-26 17:53:25
2013-09-26 17:53:26
2013-09-26 17:53:27
2013-09-26 17:53:28
2013-09-26 17:53:29
2013-09-26 17:53:30
2013-09-26 17:53:31
2013-09-26 17:53:32
2013-09-26 17:53:33
2013-09-26 17:53:34
2013-09-26 17:53:35
2013-09-26 17:53:36
2013-09-26 17:53:37
2013-09-26 17:53:38
2013-09-26 17:53:39
2013-09-26 17:53:40
2013-09-26 17:53:41
2013-09-26 17:53:42
2013-09-26 17:53:43
2013-09-26 17:53:44
2013-09-26 17:53:45
2013-09-26 17:53:46
2013-09-26 17:53:47
2013-09-26 17:53:48
2013-09-26 17:53:49
2013-09-26 17:53:50
2013-09-26 17:53:51
2013-09-26 17:53:52
2013-09-26 17:53:53
2013-09-26 17:53:54
2013-09-26 17:53:55
2013-09-26 17:53:56
2013-09-26 17:53:57
2013-09-26 17:53:58
2013-09-26 17:53:59

2013-09-26 18:53:00
2013-09-26 18:53:01
2013-09-26 18:53:02
2013-09-26 18:53:03
2013-09-26 18:53:04
2013-09-26 18:53:05
2013-09-26 18:53:06
2013-09-26 18:53:07
2013-09-26 18:53:08
2013-09-26 18:53:09
2013-09-26 18:53:10
2013-09-26 18:53:11
2013-09-26 18:53:12
2013-09-26 18:53:13
2013-09-26 18:53:14
2013-09-26 18:53:15
2013-09-26 18:53:16
2013-09-26 18:53:17
2013-09-26 18:53:18
2013-09-26 18:53:19
2013-09-26 18:53:20
2013-09-26 18:53:21
2013-09-26 18:53:22
2013-09-26 18:53:23
2013-09-26 18:53:24
2013-09-26 18:53:25
2013-09-26 18:53:26
2013-09-26 18:53:27
2013-09-26 18:53:28
2013-09-26 18:53:29
2013-09-26 18:53:30
2013-09-26 18:53:31
2013-09-26 18:53:32
2013-09-26 18:53:33
2013-09-26 18:53:34
2013-09-26 18:53:35
2013-09-26 18:53:36
2013-09-26 18:53:37
2013-09-26 18:53:38
2013-09-26 18:53:39
2013-09-26 18:53:40
2013-09-26 18:53:41
2013-09-26 18:53:42
2013-09-26 18:53:43
2013-09-26 18:53:44
2013-09-26 18:53:45
2013-09-26 18:53:46
2013-09-26 18:53:47
2013-09-26 18:53:48
2013-09-26 18:53:49
2013-09-26 18:53:50
2013-09-26 18:53:51
2013-09-26 18:53:52
2013-09-26 18:53:53
2013-09-26 18:53:54
2013-09-26 18:53:55
2013-09-26 18:53:56
2013-09-26 18:53:57
2013-09-26 18:53:58
2013-09-26 18:53:59

2013-09-26 19:53:00
2013-09-26 19:53:01
2013-09-26 19:53:02
2013-09-26 19:53:03
2013-09-26 19:53:04
2013-09-26 19:53:05
2013-09-26 19:53:06
2013-09-26 19:53:07
2013-09-26 19:53:08
2013-09-26 19:53:09
2013-09-26 19:53:10
2013-09-26 19:53:11
2013-09-26 19:53:12
2013-09-26 19:53:13
2013-09-26 19:53:14
2013-09-26 19:53:15
2013-09-26 19:53:16
2013-09-26 19:53:17
2013-09-26 19:53:18
2013-09-26 19:53:19
2013-09-26 19:53:20
2013-09-26 19:53:21
2013-09-26 19:53:22
2013-09-26 19:53:23
2013-09-26 19:53:24
2013-09-26 19:53:25
2013-09-26 19:53:26
2013-09-26 19:53:27
2013-09-26 19:53:28
2013-09-26 19:53:29
2013-09-26 19:53:30
2013-09-26 19:53:31
2013-09-26 19:53:32
2013-09-26 19:53:33
2013-09-26 19:53:34
2013-09-26 19:53:35
2013-09-26 19:53:36
2013-09-26 19:53:37
2013-09-26 19:53:38
2013-09-26 19:53:39
2013-09-26 19:53:40
2013-09-26 19:53:41
2013-09-26 19:53:42
2013-09-26 19:53:43
2013-09-26 19:53:44
2013-09-26 19:53:45
2013-09-26 19:53:46
2013-09-26 19:53:47
2013-09-26 19:53:48
2013-09-26 19:53:49
2013-09-26 19:53:50
2013-09-26 19:53:51
2013-09-26 19:53:52
2013-09-26 19:53:53
2013-09-26 19:53:54
2013-09-26 19:53:55
2013-09-26 19:53:56
2013-09-26 19:53:57
2013-09-26 19:53:58
2013-09-26 19:53:59

2013-09-26 20:53:00
2013-09-26 20:53:01
2013-09-26 20:53:02
2013-09-26 20:53:03
2013-09-26 20:53:04
2013-09-26 20:53:05
2013-09-26 20:53:06
2013-09-26 20:53:07
2013-09-26 20:53:08
2013-09-26 20:53:09
2013-09-26 20:53:10
2013-09-26 20:53:11
2013-09-26 20:53:12
2013-09-26 20:53:13
2013-09-26 20:53:14
2013-09-26 20:53:15
2013-09-26 20:53:16
2013-09-26 20:53:17
2013-09-26 20:53:18
2013-09-26 20:53:19
2013-09-26 20:53:20
2013-09-26 20:53:21
2013-09-26 20:53:22
2013-09-26 20:53:23
2013-09-26 20:53:24
2013-09-26 20:53:25
2013-09-26 20:53:26
2013-09-26 20:53:27
2013-09-26 20:53:28
2013-09-26 20:53:29
2013-09-26 20:53:30
2013-09-26 20:53:31
2013-09-26 20:53:32
2013-09-26 20:53:33
2013-09-26 20:53:34
2013-09-26 20:53:35
2013-09-26 20:53:36
2013-09-26 20:53:37
2013-09-26 20:53:38
2013-09-26 20:53:39
2013-09-26 20:53:40
2013-09-26 20:53:41
2013-09-26 20:53:42
2013-09-26 20:53:43
2013-09-26 20:53:44
2013-09-26 20:53:45
2013-09-26 20:53:46
2013-09-26 20:53:47
2013-09-26 20:53:48
2013-09-26 20:53:49
2013-09-26 20:53:50
2013-09-26 20:53:51
2013-09-26 20:53:52
2013-09-26 20:53:53
2013-09-26 20:53:54
2013-09-26 20:53:55
2013-09-26 20:53:56
2013-09-26 20:53:57
2013-09-26 20:53:58
2013-09-26 20:53:59

2013-09-26 21:53:00
2013-09-26 21:53:01
2013-09-26 21:53:02
2013-09-26 21:53:03
2013-09-26 21:53:04
2013-09-26 21:53:05
2013-09-26 21:53:06
2013-09-26 21:53:07
2013-09-26 21:53:08
2013-09-26 21:53:09
2013-09-26 21:53:10
2013-09-26 21:53:11
2013-09-26 21:53:12
2013-09-26 21:53:13
2013-09-26 21:53:14
2013-09-26 21:53:15
2013-09-26 21:53:16
2013-09-26 21:53:17
2013-09-26 21:53:18
2013-09-26 21:53:19
2013-09-26 21:53:20
2013-09-26 21:53:21
2013-09-26 21:53:22
2013-09-26 21:53:23
2013-09-26 21:53:24
2013-09-26 21:53:25
2013-09-26 21:53:26
2013-09-26 21:53:27
2013-09-26 21:53:28
2013-09-26 21:53:29
2013-09-26 21:53:30
2013-09-26 21:53:31
2013-09-26 21:53:32
2013-09-26 21:53:33
2013-09-26 21:53:34
2013-09-26 21:53:35
2013-09-26 21:53:36
2013-09-26 21:53:37
2013-09-26 21:53:38
2013-09-26 21:53:39
2013-09-26 21:53:40
2013-09-26 21:53:41
2013-09-26 21:53:42
2013-09-26 21:53:43
2013-09-26 21:53:44
2013-09-26 21:53:45
2013-09-26 21:53:46
2013-09-26 21:53:47
2013-09-26 21:53:48
2013-09-26 21:53:49
2013-09-26 21:53:50

Sql = "select * from Float_Tag  where 时间 between  '" & CDate(StartDate) & "' and  '" & CDate(StopDate) & "'And DateDiff( mi, + '" & CDate(StartDate) & "',时间) % " + "60" + "=0 "
语句有问题?请各位高手帮忙诊断下,谢谢!!


您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-11-26 11:52 , Processed in 0.040925 second(s), 7 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表