简体   繁体   中英

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. Using microsoft Power Automate i will generate a notification to be sent to the user when items require action within the next fifteen minutes.

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())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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