Skip to content

Commit

Permalink
Allow using columns from outer queries in joins
Browse files Browse the repository at this point in the history
Fixes #376
  • Loading branch information
MarkMpn committed Oct 25, 2023
1 parent 9f4349b commit 9ae6aa7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions MarkMpn.Sql4Cds.Engine/ExecutionPlanBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3840,6 +3840,9 @@ private IDataExecutionPlanNodeInternal ConvertTableReference(TableReference refe
var rhsSchema = rhs.GetSchema(context);
var fixedValueColumns = GetFixedValueColumnsFromWhereClause(query, lhsSchema, rhsSchema);

// Capture any references to data from an outer query
CaptureOuterReferences(outerSchema, null, join.SearchCondition, context, outerReferences);

var joinConditionVisitor = new JoinConditionVisitor(lhsSchema, rhsSchema, fixedValueColumns);
join.SearchCondition.Accept(joinConditionVisitor);

Expand Down

0 comments on commit 9ae6aa7

Please sign in to comment.