Solved

Find when the last time you received an order from a list of vendors in Crystal Reports or SQL

Posted on 2017-06-14
1
15 Views
Last Modified: 2017-06-14
Our company has thousands of different vendors in its ERP system.  Many of them we no longer use.  I'm trying to figure out the best way for me to create a report that will show me a distinct list of suppliers that we have used.  Or a way to show the last time something was purchased or received from a vendor.  I can use SQL, Crystal Reports or Excel to create this but would need the thought process of what to filter the report on.   My goal is to review vendors where we have not had usage from say the past three years and eliminate them from our database.
0
Comment
Question by:ITworks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 27

Accepted Solution

by:
Chris Luttrell earned 500 total points
ID: 42177276
A few clues as to what your tables and data are like would be a huge help here.  But this is the jest of what you need to find that kind of data.
select V.Vendor, MAX(O.OrderDate) LastOrder
from VendorTable V
left outer join OrderTable O on V.ID = O.VendorID
order by MAX(O.OrderDate)
having MAX(O.OrderDate) > dateadd(YEAR, -3, CURRENT_TIMESTAMP)

Open in new window

0

Featured Post

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Join & Write a Comment

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question