Link to home
Start Free TrialLog in
Avatar of jayh99
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!
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SELECT *
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)
Avatar of jayh99
jayh99

ASKER

Excellent!  Thanks for the quick response!