Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3220210
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:44:07+00:00 2026-05-17T15:44:07+00:00

I am facing a problem for writing an sql query which should be easy

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:44:07+00:00Added an answer on May 17, 2026 at 3:44 pm
    update Request 
    set State = 'Cancelled' 
    where RequestID = @MyRequestID
        and State = 'Submitted' 
        and LastModifiedOn < dateadd(mi, -10, getdate()) 
    

    Note: This query is designed to be SARGable for best performance by not using LastModifiedOn in a function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing a situation that I have problem understanding... I am writing a
I am trying to hide an array of elements but facing problem while writing
I'm not actually writing this software myself, but it occurred to me that I
I am facing a problem with writing a MySQL query to fetch distinct results.
I am facing problem with iframe that too in chrome. How to make IFRAME
I am facing problem to get variable from query string. I have used htaccess
Hi I am facing a problem with the like command in SQL, I want
I am facing one problem while writing one xslt: xml: <students> <studentDetails tag=to id=1
I'm facing a problem that I don't know how to solve and am hoping
I'm writing Unit test cases in Visual Studio 2008. I'm facing a weird problem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.