I have following records in DB table. I want to modify the query to bring only the distinct rep codes with Submitted_Date in descending order. how do I get that? This is what I tried
select distinct Rep_Code as repCode , Rep_Name as repName, Submitted_Date
FROM USBI_Interaction
where Rep_Code in
('T203','A107') order by Submitted_Date desc
T203 Amy N France 2/5/2019 6:52:15 AM
T203 Amy N France 2/5/2019 6:26:14 AM
T203 Amy N France 2/5/2019 6:23:27 AM
A107 Alan J Schmidt 2/5/2019 5:47:44 AM
T203 Amy N France 2/5/2019 1:24:35 AM
I should get result like following.(Each record with distinct rep code .If there are multiple records with same rep code get the record which has the latest submitted date)
T203 Amy N France 2/5/2019 6:52:15 AM
A107 Alan J Schmidt 2/5/2019 5:47:44 AM