jayh99
asked on
SQL Join on Most Recent Record
I have two tables in SQL, table one has information, and table two has more dynamic information that is related to table one.
Table1
ID
LRSN
INFO
MOREINFO
Table 2
ID
LRSN
DESCRIPTION
LAST_UPDATE
I would like to join the two tables on LRSN, and pull the Description of the most recent Last_Update record from table two. Can someone help me out with this relationship? Thanks in advance for the help!
Table1
ID
LRSN
INFO
MOREINFO
Table 2
ID
LRSN
DESCRIPTION
LAST_UPDATE
I would like to join the two tables on LRSN, and pull the Description of the most recent Last_Update record from table two. Can someone help me out with this relationship? Thanks in advance for the help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent! Thanks for the quick response!
FROM Table1 t1
INNER JOIN Table2 t2 ON t1.LRSN = t2.Lrsn
WHERE T2.Last_Update = (SELECT MAx(last_update) from tabel2 where lrsn = t2.lrsn)