我正在尝试tbl_RUR_Enclosures
使用 2nd table foreign key从 3rd table 获取 count(*) tbl_RUR_RepurchaseDemands
。
对不起,这是错误的,我给出了错误的 SQL 查询。更新的在这里*
更新
select [loan number] as LoanNum, [Finding ID] as FindingID,
[Finding Topic], [Finding Narrative], [Reps Breached], T.*,
(select COUNT(*) from dbo.tbl_RUR_Enclosures where
tbl_RUR_Enclosures.[Finding ID]=tbl_RUR_RepurchaseDemands.
[Finding ID])
from dbo.tbl_RUR_RepurchaseDemands as RR join
[tbl_DefectFindingEnclosuresMateriality] as T on
T.[AP_ID] = RR.[AP_ID] where [loan number] in
(select [Loan Number] from tbl_RUR_Comprehensive
where Shelf = 'CWABS' and Series='2004-K' and Batch=1
and [Loan Number]='41090261' ) order by [Loan Number]
它正在抛出错误Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "tbl_RUR_RepurchaseDemands.Finding ID" could not be bound.
帮帮我