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 8959727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:30:25+00:00 2026-06-15T15:30:25+00:00

thanks for taking the time to help me out! I’m trying to make SQL

  • 0

thanks for taking the time to help me out! I’m trying to make SQL do something that I imagine is easy for anybody who knows SQL, but I’m beating my head against at this point.

I have me a little table like this –

Update   Order    UpdateDate                OrderDate
9297    3590    2012-12-06                    2012-12-06 
9298    3590    2012-12-06                    2012-12-06 
9356    3590    2012-12-07                    2012-12-06 
9369    3590    2012-12-08                    2012-12-06 
9381    3590    2012-12-10                    2012-12-06 

My goal is to find orders that have not been updated in the last 3 days.

The ugly version of what I’m trying to do is something like this –

Select order from orderstable
where cast(max(updatedate)-getdate() as int) >3

The goal here is to have the command return “orders” that have not been updated in the last 3 days. My current problem is I don’t know how to make SQL focus on just the “most recent” updatedate for the order.

  • 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-06-15T15:30:27+00:00Added an answer on June 15, 2026 at 3:30 pm

    The easiest way is just a date comparison:

    select *
    from orderstable ot
    where datediff(day, updatedate, getdate()) > 3
    

    I see, you have multiple records for each order and you want orders that have no update in the past three days. I would do this with an aggregation:

    select order
    from orderstable ot
    group by order
    having min(datediff(day, updatedate, getdate())) > 3
    

    You can also do it by looking for orders that don’t have updates in the last three days:

    select distinct order
    from orderstable
    where order not in (select order
                        from orderstable
                        where datediff(day, updatedate, getdate()) <= 3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks for taking some time to help me out. Using: Microsoft Visual C# 2010
Thanks for taking the time to help out. I'm using ASP.NET WebForms and I
Thanks for taking the time to possibly help me out! I am currently having
thanks for taking the time to look at my question. I've been diving into
Thanks for taking the time to read this. I have an unknown number of
thanks for taking the time to stop by my question. Below you will find
first of all thanks for taking your time! I'm a junior Dev, working with
First of all thanks for taking the time to look into this. I store
Thanks everyone for taking the time to read this. I have styled my navigation
Thanks in advance for taking the time to read my question. I'm using MySQL

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.