I have to query from some tables that have duplicate records with the same unique id but I just want the recent record with that unique id
select tblEmpl.*, tblFtpTrans.actiondate, tblFtpTrans.actionflag, tblLocs.descript
from tblEmpl 
left join tblFtpTrans on tblEmpl.eight_id = tblFtpTrans.eight_id 
join TblLocs on tblLocs.location = tblEmpl.location
where (tblFtpTrans.ActionFlag='N' or tblFtpTrans.ActionFlag = 'D')
and tblEmpl.estatus='A' and tblEmpl.location='TRN'
order by ActionDate desc;
| Unique Id | fname | lname | actiondate | 
|---|---|---|---|
| 9442 | Tom | lee | 2020-12-19 | 
| 9442 | Tom | lee | 2020-10-29 | 
| 3969 | Pat | Ross | 2015-05-21 | 
| 2572 | Amy | lee | 2014-11-24 | 
| 2572 | Amy | lee | 2016-04-07 | 
What I would want is
| Unique Id | fname | lname | actiondate | 
|---|---|---|---|
| 9442 | Tom | lee | 2020-12-19 | 
| 2572 | Amy | lee | 2016-04-07 | 
| 3969 | Pat | Ross | 2015-05-21 | 
Any help?
 
    