CREATE TABLE #Table1
([id] varchar(2), [name] varchar(4), [Payment Amount] int)
INSERT INTO #Table1
([id], [name], [Payment Amount])
VALUES
('S1', 'Jack', 10000),
('S2', 'May', 20000),
('S3', 'Amy', 30000)
CREATE TABLE #Table2
([id] varchar(2), [name] varchar(4), [Payment Amount] int)
;
INSERT INTO #Table2
([id], [name], [Payment Amount])
VALUES
('X1', 'Jack', 10000),
('X2', 'Amy', 30000)
select A.id,A.name T1name ,isnull(B.name,'') T2name,A.[Payment Amount] from #Table1 A left join #Table2 B on A.name=B.name
and A.[Payment Amount]=B.[Payment Amount]
выход
id T1name T2name Payment Amount
S1 Jack Jack 10000
S2 May 20000
S3 Amy Amy 30000