Can anyone help me complete my query so that I can:
Return unique records only by filtering out duplicates by selecting the latest date only?
I've have the following query that, if the source table contains multiple entries of the same Servername, returns duplicate rows.
select Servers.Servername, [Update Frequency], [Updaye frequency Type], dbo.WU_Servers.ServerName AS WU_Servers_Servername, dbo.WU_Servers.[Last Patch], dbo.WU_Servers.UniqueBatch, dbo.WU_Servers.dateTimeHit
from Servers
left join WU_Servers
on dbo.Servers.Servername = dbo.WU_Servers.ServerName
where [Update Frequency] = 60 and [Last Patch] < DATEADD(DAY, 30, GETDATE())
My left join is on Servername in each table and it is this being returned more than one if there is more than one entry in the WU_Servers.Servername table with the same name.
For each row returned there is a WU_Servers.[Last Patch] column and for duplicate rows I need only the latest date from the WU_Servers.[Last Patch] column.
As an example, this is the data being returned from my query:

You can see that the [Last Patch] column for the 2 records is different, one is for 2020-11-11 00:00:00.000 and one for 2020-11-12 00:00:00.000. It is the record with the latest date 2020-11-1*2* 00:00:00.000 that I need.
Thanks for looking!
Regards