This means for each part number there will be more than one transaction date, what i am trying to extract is the last transaction date for each part number in a driving table.
so..
I have created a table that has 1 column named PART_NO, with numerous part numbers contained in it, i want to left join this to my transaction table and return the last transaction for those part numbers. The SQL so far is as follows:
Expand|Select|Wrap|Line Numbers
- SELECT A.PART_NO,
- OUTLET_NUM,
- TXN_DATE
- FROM TRANSACTIONS A,
- (SELECT MAX(TXN_DATE) AS MAXDATE, PART_NO
- FROM TRANSACTIONS
- GROUP BY PART_NO) MAXRESULTS
- WHERE A.PART_NO = MAXRESULTS.PART_NO
- AND A.TXN_DATE = MAXRESULTS.MAXDATE