select
format(max(docdate) , 'd','us') as DocDate ,
pk.vendorid ,
DOCNUMBR,
DOCTYPE
from pm00400 pk inner join pm00200 pm on pm.vendorid = pk.vendorid
group by pk.vendorid, DOCNUMBR , doctype
order by pk.vendorid
I want to pull the last (max docdate) document date from the PM00400 for a vendor and if it is after the > date, display this information.
I have removed all the other pieces from the PM00200 table that we are bringing over as it is just clutter.
CHALLENGE is that I can not get just the LAST Document Date. When I run this I get all the transactions for the vendors. It seems to ignor the MAX date
I have tried a number of subquery selects, but I am doing something wrong.
Anyone got a fix for a tired consultant.