多部分标识符“Loan.LoanNo”无法结合 [英] The multi-part identifier "Loan.LoanNo" could not be bond
本文介绍了多部分标识符“Loan.LoanNo”无法结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello Expert
我的查询中有错误。查询是:
Hello Expert
There is an error in my query. The query is:
Select Request.AccNo,
[Owner].ClientID,
nRequest.RequestNo,
nRequest.RequestID,
nRequest.LoanTypeID,
Loan.Amount As LoanAmount,
Loan.LoanNo
From Teflan.dbo.Loan As Loan,
Teflan.dbo.LoanRequest As Request,
Teflan.dbo.AccOwner As [Owner],
Teflan.dbo.AccAction As [Action],
LoanRequest.dbo.LoanRequest As nRequest
Cross Apply /*Error is in below line*/
Account.dbo.GetNextPayInfo(Loan.LoanNo) As LoanNextPayInfo
Where Request.RequestID = Loan.RequestID And
[Owner].AccNo = Request.AccNo And Request.ClientID = [Owner].ClientID And
nRequest.OriginalID = Request.RequestID And
[Action].AccNo = Loan.LoanNo And [Action].ActionID = @PayActionID
错误文字是:
The Error text is:
The multi-part identifier "Loan.LoanNo" could not be bound
如何我能解决吗?
谢谢。
How can I fix it?
Thank you.
推荐答案
你不能在子查询中使用主查询中的表别名 - 它们超出了范围。
这里的解释 [ ^ ]
You can't use the table aliases from the main query in a sub-query - they are out of scope.
an explanation here[^]
要与函数交叉应用的表必须在函数之前。
比较问题中的查询和下面的查询以查看更改。
The table that you want to cross apply with a function must be exactly before the function.
Compare the query in the question and the below query to see changes.
Select Request.AccNo,
[Owner].ClientID,
nRequest.RequestNo,
nRequest.RequestID,
nRequest.LoanTypeID,
Loan.Amount As LoanAmount,
Loan.LoanNo
From Teflan.dbo.LoanRequest As Request,
Teflan.dbo.AccOwner As [Owner],
Teflan.dbo.AccAction As [Action],
LoanRequest.dbo.LoanRequest As nRequest,
Teflan.dbo.Loan As Loan
Cross Apply
Account.dbo.GetNextPayInfo(Loan.LoanNo) As LoanNextPayInfo
Where Request.RequestID = Loan.RequestID And
[Owner].AccNo = Request.AccNo And Request.ClientID = [Owner].ClientID And
nRequest.OriginalID = Request.RequestID And
[Action].AccNo = Loan.LoanNo And [Action].ActionID = @PayActionID
祝你好运
Good luck
这篇关于多部分标识符“Loan.LoanNo”无法结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文