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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:47:48+00:00 2026-05-13T07:47:48+00:00

I have a database table with the following structure – Week_End Sales 2009-11-01 43223.43

  • 0

I have a database table with the following structure –

Week_End      Sales
2009-11-01    43223.43
2009-11-08     4324.23
2009-11-15    64343.23
...

Week_End is a datetime column, and the date increments by 7 days with each new entry.

What I want is a SQL statement that will identify if there is a week missing in the sequence. So, if the table contained the following data –

Week_End      Sales
2009-11-01    43223.43
2009-11-08     4324.23
2009-11-22    64343.73    
...

The query would return 2009-11-15.

Is this possible? I am using SQL Server 2008, btw.

  • 1 1 Answer
  • 1 View
  • 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-13T07:47:49+00:00Added an answer on May 13, 2026 at 7:47 am

    You’ve already accepted an answer so I guess you don’t need this, but I was almost finished with it anyway and it has one advantage that the selected solution doesn’t have: it doesn’t require updating every year. Here it is:

    SELECT T1.*
    FROM Table1 T1
    LEFT JOIN Table1 T2
    ON T2.Week_End = DATEADD(week, 1, T1.Week_End)
    WHERE T2.Week_End IS NULL
    AND T1.Week_End <> (SELECT MAX(Week_End) FROM Table1)
    

    It is based on Andemar’s solution, but handles the changing year too, and doesn’t require the existence of the Sales column.

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

Sidebar

Related Questions

I have a database table with the following structure - Week_End Sales 2009-11-01 43223.43
I have no control over database schema and have the following (simplified) table structure:
I have the following table structure in my database: create table Encargado( ID int
I have the following database structure: Sites table id | name | other_fields Backups
I have the following database structure: Event table Id - Guid (PK) Name -
I have a database-table with the following structure: id1 | id2 | weight Now
I have a database with the following structure: CREATE TABLE entity ( id SERIAL,
I have a MySQL database with the following table structure: TransactionType : Transaction_Amount, Transaction_ID,
I have a table in database which has following structure(data) : +--------------------------+ Organization +--------------------------+
I have a database/table in SQLITE using the following structure CREATE TABLE milestones (

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.