简体   繁体   English

查询具有未来 20 分钟内日期/时间的项目

[英]Querying items that have a date/time within the next 20 minutes

I am working on generating a notification when new items are added to a table.我正在努力在将新项目添加到表格时生成通知。

The table will be a filtered version of the [OrderTasks] Table.该表将是 [OrderTasks] 表的过滤版本。 Using microsoft Power Automate i will generate a notification to be sent to the user when items require action within the next fifteen minutes.使用 microsoft Power Automate,当项目需要在接下来的 15 分钟内采取行动时,我将生成一个通知发送给用户。

I am using the below query but i am getting empty results.我正在使用以下查询,但结果为空。

i have tried multiple other recommendations on here but have been unsuccessful我在这里尝试了多种其他建议,但均未成功

SELECT *
FROM [dbo].[OrderTasks]
WHERE  (dbo.OrderTasks.ActionDate BETWEEN DATEADD(HH, 0, GETDATE()) AND DATEADD(MI, 20, GETDATE()))

Would this work for you?这对你有用吗?

SELECT *
FROM [dbo].[OrderTasks]
WHERE  ActionDate >= GetDate() and ActionDate <= DateAdd(MINUTE, 20, GetDate())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM