Это должно вам помочь
create table #sample (type char(1), date datetime, Id bigint)
insert into #sample values('A', '5/22/2019 4:33', 1065621)
insert into #sample values('A', '5/22/2019 4:33', 1065181)
insert into #sample values('A', '5/22/2019 4:33', 1064212)
insert into #sample values('B', '11/7/2017 1:07', 540180)
insert into #sample values('B', '11/7/2017 1:07', 540179)
insert into #sample values('B', '11/7/2017 1:07', 540177)
select * from #sample
select [type], [date], max(id)
from #sample
group by [type], [date]
select distinct [type], [date], max(id) over(partition by [type], [date] )
from #sample
Drop table #sample