Skip to content

FromQuery无限连表 #1291

Answered by 2881099
ROMYIM asked this question in Q&A
Oct 11, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

明白你的意思,可以这样写:

_freesQuery
    .FromQuery(_procInfoQuery)
    .InnerJoin((a,b) => ....)
    .WithTempQuery((a,b) => new { item1 = a, item2 = b })
    .FromQuery(_caseInfoQuery)
    .InnerJoin((a,b) => a.item1.id == b.id)
    ...

产生的 Sql :

SELECT ...
FROM
(
    SELECT ...
    FROM [case_fee_list] CaseFeeList With(NoLock)
    INNER JOIN (select case_id, proc_id from [case_proc_info] With(NoLock) where is_enabled = 1) CaseFeeList__CaseProcInfo ON 
    CaseFeeList__CaseProcInfo.[proc_id] = CaseFeeList.[proc_id] 
) a
 INNER JOIN 
    (select case_id from [case_info]  With(NoLock) where customer_id  = N'6B3A0677-789C-4F21-9994-591549D4E843') CaseFeeList__CaseProcInfo__CaseInfo
     ON CaseFeeLis…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Jess-Qiu
Comment options

Answer selected by ROMYIM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants