您可以在没有表之间关系的情况下进行连接。下面的示例显示了我认为您的目标。
DECLARE @tableone TABLE(id int,FirstName varchar(50),Secondname varchar(50))
insert into @tableone values(1,null, null);
insert into @tableone values(2,null, 'Dev');
insert into @tableone values(3,'Arjun', null);
insert into @tableone values(4,'Jack', 'Bilalo');
DECLARE @tabletwo TABLE(id int,FirstName varchar(50),Secondname varchar(50))
insert into @tabletwo values(1,'John', 'cena');
insert into @tabletwo values(2,'Michel', 'Dev');
insert into @tabletwo values(3,'Arjun', 'Ramn');
insert into @tabletwo values(4,'Jack', 'Bilalo');
SELECT A.Id, COALESCE(A.FirstName,B.FirstName) As Firstname, COALESCE(A.Secondname,B.Secondname) As Secondname
FROM @tableone A
JOIN @tabletwo B
ON A.id = B.id