社区
MS-SQL Server
帖子详情
如何每间隔一段时间查询数据库数据?
xql923
2003-12-16 05:11:51
数据库表中每一小时有一个参数值,例如:
time zr
01:00 1
02:00 4
03:00 3
04:00 23
05:00 65
......
23:00 4
00:00 76
.................
如何用sql语句来实现每间隔n小时的数据?
time zr
01:00 1
0n:00 x
.....................
thank you!!
...全文
156
8
打赏
收藏
如何每间隔一段时间查询数据库数据?
数据库表中每一小时有一个参数值,例如: time zr 01:00 1 02:00 4 03:00 3 04:00 23 05:00 65 ...... 23:00 4 00:00 76 ................. 如何用sql语句来实现每间隔n小时的数据? time zr 01:00 1 0n:00 x ..................... thank you!!
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
xzx760815
2003-12-17
打赏
举报
回复
是不是查看當天的﹕
select * from table
where (datepart(hour,time))%2=0 and convert(char(10),time,111)=convert(char(10),getdate(),111)
realgz
2003-12-16
打赏
举报
回复
如果0点起算:
select * from table
where (datepart(hour,time))%2=0
realgz
2003-12-16
打赏
举报
回复
如果1点起算:
select * from table
where (datepart(hour,time)-1)%2=0
xql923
2003-12-16
打赏
举报
回复
就是每天每一小时,数据库表就有一个数据:
time(类型:datetime) zr(类型:int)
2003-01-01 00:00:00 x1
2003-01-01 01:00:00 x2
2003-01-01 02:00:00 x3
.....................................
如何查询数据,是以每天2小时为间隔?
例如:2003-01-01 00:00:00
2003-01-01 02:00:00
2003-01-01 04:00:00
.......................
如何写sql语句?
xql923
2003-12-16
打赏
举报
回复
就是每天每一小时,数据库表就有一个数据:
time(类型:datetime) zr(类型:int)
2003-01-01 00:00:00 x1
2003-01-01 01:00:00 x2
2003-01-01 02:00:00 x3
.....................................
如何查询数据,是以每天2小时为间隔?
例如:2003-01-01 00:00:00
2003-01-01 02:00:00
2003-01-01 04:00:00
.......................
如何写sql语句?
wzh1215
2003-12-16
打赏
举报
回复
select * from table where cast(left(time,2) as int)-1)%n=0
realgz
2003-12-16
打赏
举报
回复
select * from table where (left(time,2)-1)%n=0
如果是datetime 请使用datepart(hour,time)
zjcxc
元老
2003-12-16
打赏
举报
回复
没看明白.
在MySQL
数据
库中怎么查询出两个时间段之间的
数据
?
在MySQL
数据
库中怎么查询出两个时间段之间的
数据
?
定时任务:每隔
一段时间
从
数据
库获取最新记录
//每隔30分钟执行一次 // @Scheduled(cron = "0 */30 * * * ?") public void findAllProd(){ try{ // 创建一个
数据
库连接 Connection con = null; PreparedStatement pre = null; ResultSet result = null; ...
mysql按一定时间
间隔
查询
表格
数据
是每隔三十秒传递一次,每行
数据
的时间
间隔
相等。因此可以创建索引id,设为主键自增,根据id来
间隔
查询。 #获取列表最后一行的id,相当于记录当前时间 SET @id := (SELECT id FROM t_temperature order by ...
postgresql
数据
库时间
间隔
数据
查询
当前时间向前推一天:SELECT current_timestamp - interval '1 day'当前时间向前推一个月:SELECT current_timestamp - interval '1 month'当前时间向前推一年:SELECT current_timestamp - interval '1 year'当前...
oracle查询
间隔
时间
数据
在
数据
库中查出所有
数据
分钟
间隔
10的
数据
。 select ddatetime from table where mod(to_char(ddatetime,'mi'),10) = 0 and to_char(ddatetime,'ss') = 00 mod是oracle的一个求模函数。如mod(2,1):表示2%1,得到...
MS-SQL Server
34,838
社区成员
254,632
社区内容
发帖
与我相关
我的任务
MS-SQL Server
MS-SQL Server相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章