答案 0 :(得分:0)
您的预期结果没有任何意义,因为它排除了与客户相关的收据。但他是一个简单的加入......
declare @Table1 table (ApplicationID int identity (1,1), ClientID int)
declare @Table2 table (RecieptID int identity(1,1), ClientID int)
declare @Table3 table (ID int identity(1,1), RecepitID int, FeeID int)
insert into @Table1
values
(1), (2), (3)
insert into @Table2
values
(1), (1), (3)
insert into @Table3
values
(1, 841), (2, 840), (3, 220)
select
t1.ApplicationID
,t1.ClientID
,t2.RecieptID
,t3.FeeID
from
@Table1 t1
left join @Table2 t2 on t1.ClientID = t2.ClientID
left join @Table3 t3 on t3.RecepitID = t2.RecieptID