web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Item Last receipt date with vendor and cost

(0) ShareShare
ReportReport
Posted on by 5,080

I am looking to get the last receipt date of an Item with the cost and vendor.

I queried the IV30300 table with 

select distinct itemnmbr, max(docdate) from IV30300 group by ITEMNMBR

Which gives me last transaction date and Item

I did run a select where DOCTYPE = '4' ...I cannot seem to get the syntax right with the max date??

 I just need the receipts ...and I need the Vendor (CUSTNMBR) and cost

Can someone help with the script...I am not that proficient with SQL

Tami

Categories:
I have the same question (0)
  • Verified answer
    Dean Marty Profile Picture
    on at
    RE: Item Last receipt date with vendor and cost

    Hi Tami

    I do not claim to be a SQL expert either   

    That said, this seems to work in a quick review of my data here, so you can give this a try and see how it works for you

    SELECT t.ITEMNMBR, t.DOCNUMBR, r.DOCDATE
    FROM (
    SELECT ITEMNMBR, MAX(DOCDATE) as DOCDATE
    FROM iv30300
    WHERE DOCTYPE = 4
    GROUP BY ITEMNMBR
    ) r
    INNER JOIN IV30300 t
    ON t.ITEMNMBR = r.ITEMNMBR AND t.DOCDATE = r.DOCDATE
    WHERE DOCTYPE = 4
    ORDER BY ITEMNMBR

    Thanks!

    Dean

  • Tami Farrelly Profile Picture
    5,080 on at
    RE: Item Last receipt date with vendor and cost

    Thank you so much for your help with this...I will try and tweak to get the fields needed.

    Tami

    SELECT t.ITEMNMBR, t.CUSTNMBR,t.unitcost, r.DOCDATE
    FROM (
    SELECT ITEMNMBR, MAX(DOCDATE) as DOCDATE
    FROM iv30300
    WHERE DOCTYPE = 4
    GROUP BY ITEMNMBR
    ) r
    INNER JOIN IV30300 t
    ON t.ITEMNMBR = r.ITEMNMBR AND t.DOCDATE = r.DOCDATE
    WHERE DOCTYPE = 4
    ORDER BY ITEMNMBR

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,047

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 885 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 592 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans