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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:44:55+00:00 2026-06-10T04:44:55+00:00

I have an order database. Each order can have multiple SKUs on the order.

  • 0

I have an order database. Each order can have multiple SKUs on the order. Likewise, SKUs can be attached to multiple orders. Each order has a date field that stores the date it was created.

  • Table1 = Details table which stores all the SKU information attached to order
  • Table2 = Summary that lists Order ID and ship date which cross reference with Table1 to get more detail of each order

What I am trying to find is SKUs that aren’t attached to any orders after a certain date. In other words, I want a list of SKUs that haven’t been ordered in the last 30 days.

It seems that NOT BETWEEN should work, but it keeps returning SKUs that have been on orders past 7/21/2012. Here is the query I am using:

SELECT DISTINCT table1.sku, table2.ship_date
FROM table1, table2
WHERE table1.orderID = table2.orderID
AND table2.ship_date NOT BETWEEN  DATE ('2012-07-21') and DATE('2012-08-23')
ORDER BY table1.ship_date ASC;

Any help will be very appreciated.

  • 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-10T04:44:57+00:00Added an answer on June 10, 2026 at 4:44 am

    You need to use not in and base it on the sku table:

    SELECT sku
    FROM sku_table -- the table with the complete list of skus
    where sku not in (
        -- all skus that were ordered after 2012-07-21
        SELECT sku
        from table1
        WHERE order_date > DATE('2012-07-21')
        union -- fyi union removes duplicates
        -- all skus that were shipped after 2012-07-21
        SELECT table1.sku
        from table2
        join table1 on table1.orderID = table2.orderID
        WHERE table2.ship_date > DATE('2012-07-21')
    )
    

    This query will also return SKUs that have never been ordered.

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

Sidebar

Related Questions

I have a SQL Server 2005 database that stores data for multiple users. Each
I have a dynamic rows coming from the database. each row has an order
I have an Access database of 4M rows, each representing an individual customer order.
I have an app that must get data from the Sqlite database in order
I have been working on a database that holds order numbers and order information.
Can I order my users in the database, so I don't have to say
I have a table products and table sizes. Each product can have multiple sizes.
I have a database which has multiple nested associates. Basically, the structure is as
I have a large SQL script that creates my database (multiple tables, triggers, and
I have records in the database with the sort order number. Now I want

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.