diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs index 2fb7a847d..35d404c7e 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs @@ -45,7 +45,13 @@ namespace SqlSugar new SubSelect() { Context = this.Context }.SetShortName(exp, "+"); } var argExp = exp.Arguments[0]; - var result = "WHERE " + SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple); + var copyContext = this.Context; + if (this.Context.JoinIndex > 0) + { + copyContext = this.Context.GetCopyContextWithMapping(); + copyContext.IsSingle = false; + } + var result = "WHERE " + SubTools.GetMethodValue(copyContext, argExp, ResolveExpressType.WhereMultiple);