Updating a table with the max date of another table

Posted by moleboy on Stack Overflow See other posts from Stack Overflow or by moleboy
Published on 2010-03-19T16:19:56Z Indexed on 2010/03/19 16:21 UTC
Read the original article Hit count: 244

Filed under:
|
|

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!

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about plsql