I have this SQL bellow that i use to pull resources from a table.
The thing is that in TL_RESOURCE_TRLR A i may have multiple A.TRLR_TYPE_ID based on A.EFFECTIVE
So i only want to extract the most updated effective date per TRLR_TYPE_ID and not all the effective dates even the old one. Just the very last one
How can i update this?
Thanks again for your help
SELECT DISTINCT A.CARRIER_ID, A.EFFECTIVE, A.TRLR_TYPE_ID, A.CURRENT_NUM_VEHICLES FROM TL_RESOURCE_TRLR A, CARRIER_EQUIP B WHERE A.CARRIER_ID = B.CARRIER_ID(+) AND A.TRLR_TYPE_ID = B.TRLR_TYPE_ID(+) AND B.CARRIER_ID IS NULL -- EXCLUDE ROWS ADDED BECAUSE OF THE OUTER JOINORDER BY A.CARRIER_ID ASC;
Let me look at this, i'm not having the same result in both SQL