Updating a table with the max date of another table
- by moleboy
In Oracle 10g, I need to update Table A with data from Table B.
Table A has LOCATION, TRANDATE, and STATUS.
Table B has LOCATION, STATUSDATE, and STATUS
I need to update the STATUS column in Table A with the STATUS column from Table B where the STATUSDATE is the max date upto and including the TRANDATE for that LOCATION (basically, I'm getting the status of the location at the time of a particular transaction).
I have a PL/SQL procedure that will do this but I KNOW there must be a way to get it to work using an analytic, and I've been banging my head too long.
Thanks!