Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Query - ONLY inventory that hasn't moved in past 90 days

Query - ONLY inventory that hasn't moved in past 90 days

Query - ONLY inventory that hasn't moved in past 90 days

I need to determine which inventory items we currently have in stock that have not moved in the past 90 days so we can try and use them up. I am trying to look at all line items on an invoice within the past 90 days, but only include all of the items that do NOT show up on these invoices. However, it is not giving me the results I need. Please help. Below is what I have so far (OITM is the item table and INV1 is the invoice rows):


declare @strt as datetime
declare @d90 as datetime

set @strt = dateadd(day, 0, Getdate())
set @d90 = dateadd(day, -90, @strt)

SELECT T0.ItemCode, T0.OnHand, T0.LastPurPrc, T0.onhand * T0.LastPurPrc AS 'Total'
ON T0.ItemCode = T1.ItemCode
WHERE (t1.docentry = Null OR t1.docdate not between @d90 and @strt)
AND T0.OnHand != 0

/* This query returns the item numbers, the in stock qty, last purchase price and total cost of inventory in stock of all items not sold within the past 90 days. It does includes the following:
- items not on an invoice at all
- items not on an invoice within the past 90 days
- items with inventory in stock*/

RE: Query - ONLY inventory that hasn't moved in past 90 days

So far, so good!!!

Thank you!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close