[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 39
  • Last Modified:

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

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.
1 Solution
Chris LuttrellSenior Database ArchitectCommented:
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


Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now