How can I run this query using auto trigger 5 minutes before the time of next prayer?
SELECT
DATEADD(minute, -5, (SELECT TOP 1 TIME
FROM prayertimes
WHERE Time > sysdatetime())) AS TIME
Here are details of the prayertimes
table:
Id P_id TIME
---------------------------------
698 3 2016-10-08 15:31:00.000
699 4 2016-10-08 18:02:00.000
700 5 2016-10-08 19:32:00.000
701 1 2016-10-09 04:59:00.000
702 2 2016-10-09 12:08:00.000
703 3 2016-10-09 15:30:00.000
704 4 2016-10-09 18:02:00.000
705 5 2016-10-09 19:32:00.000
Let us say that next datetime is 2016-10-08 15:31:00.000
.
Then I want to trigger the query automatically at 2016-10-08 15:26:00.000
.
Any stored procedure?
Thanks