I have sample data like this
DECLARE @TBL TABLE(col1 VARCHAR(100),col2 varchar(100))
INSERT INTO @TBL VALUES ('server-1','11111')
INSERT INTO @TBL VALUES ('server-2','22222')
INSERT INTO @TBL VALUES ('server-3','33333')
INSERT INTO @TBL VALUES ('server-4','44444')
DECLARE @TBL2 TABLE(col1 VARCHAR(100),col2 varchar(100))
INSERT INTO @TBL2 VALUES ('server-1.mydomain.com','2 oct 2024')
INSERT INTO @TBL2 VALUES ('server-1.mydomain.com','1 oct 2024')
INSERT INTO @TBL2 VALUES ('server-1.mydomain.com','3 oct 2024')
INSERT INTO @TBL2 VALUES ('server-2.mydomain.com','1 oct 2024')
INSERT INTO @TBL2 VALUES ('server-3.mydomain.com','1 sept 2024')
INSERT INTO @TBL2 VALUES ('server-3.mydomain.com','3 oct 2024')
select * from @tbl
select * from @tbl2
and the result is

Now some one can help to to join both table with this criteria :
- join tbl with tbl2 with col1 as key, and when joining to the tbl2 get only last record by col2 asc
- any record with no data in the tbl2 will showing as null or empty.
So the final result is :
