I am facing a problem for writing an sql query which should be easy I guess but I am not able to concentrate on that query. Hence taking some help from this website.
Problem: I have an table "Request" which has following columns -
CreatedOn: When I create new request, the CreatedOn is filled up with current datetime
LastModifiedOn: When somebody modifies the record, this field is updated with that modified current datetime. By default, this is equal to createdOn when request is first created.
Now logic to check is - Initially the request state is "Submitted". If the request is not modified for next 10 minutes or in 10 minutes interval, then the request state should get updated to "Cancelled". Now I am not able to get how to write this query.
EDIT: if the request is modified in any 10 mins interval, then I dont want to update request to cancelled. i.ei In general I want to update status to cancelled only if the record is not modified in last 10 mins
Let me know if any other details are required. You can assume there is also a RequestID column which is unique.