I am attempting (without success thus far) to write a query that will join 3 tables and return the most recent record based on a distinct value.
Table A
itemnum | itemname
-------- | --------
123 | document #1
456 | document #2
Table B
itemnum | keyvaluedate
------- | -------------
123 | 2015-09-05 00:00:00.000
456 | 2011-06-04 00:00:00.000
789 | 2011-06-04 00:00:00.000
546 | 2011-06-04 00:00:00.000
378 | 2011-06-04 00:00:00.000
Table C
itemnum | keyvaluebig
-------- | -----------
123 | 123456
456 | 123456
545 | 987654
387 | 987654
Table A holds all of the records. What I need to find is the most recent record (keyvaluedate from table b) for each distinct project (keyvaluebig from table c).
The itemnum data is always unique. The keyvaluedate from Table B and the keyvaluebig from Table C both non-distinct values present.
What is the best way to go about this?