gpt4 book ai didi

mysql - Sql-如何获取最近5分钟的数据

转载 作者:行者123 更新时间:2023-12-02 03:04:25 25 4
gpt4 key购买 nike

您好,我正在尝试从数据库中提取最后 5 分钟的数据。我在下面编写的查询没有提取我需要的数据。

Select e.*
from Event e
where e.whenoccurred >= datefunc('10/01/2019 00:00 -05:00', '-5 minutes')
and dateadd(minutes,-5,getdate())

我收到错误

Query has failed: no such column: minutes

有什么想法可以帮忙吗?

最佳答案

SysDate returns the current date and time set for the operating system on which the database resides. The datatype of the returned value is DATE, and the format returned depends on the value of the NLS_DATE_FORMAT initialization parameter. The function requires no arguments. In distributed SQL statements, this function returns the date and time set for the operating system of your local database.

此查询获取 sysdate 减去五分钟。

 select *
from event
where whenoccured >= sysdate - (5/1440)

关于mysql - Sql-如何获取最近5分钟的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59339576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com