-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Left Join with Where before DefaultIfEmpty not working #17382
Comments
Duplicate of #17112 |
from account in context.Accounts
where account.Id == 6
join steam in context.Streams on account.Id equals steam.AccountId
join subscription in context.Subscriptions on account.Id equals subscription.TargetAccountId into
groupJoin
from subscription in groupJoin.Where(subscription => subscription.Date > steam.StreamStart && subscription.Date < steam.StreamEnd).DefaultIfEmpty()
select new {account, steam, subscription}; That is not left join. In order for it to be left join, you cannot reference any parameter from outer scope inside select many. SelectMany collectionSelector needs to be fully in terms of grouping element only. |
Will #17112 also solve this scenario in the new release? |
The scenario you write it Outer Apply operation in SqlServer. It would probably be Left Join lateral in Postgre. It is not left join. |
I'm trying to perform a left join, but it creates a subquery in the join that doesn't work.
I'm using Npgsql.EntityFrameworkCore.PostgreSQL 2.2.4, but the error also ocurs with the SqlServer provider, so it's not Npgsql provider specific.
I created a sample project to illustrate the problem
This is my Linq query which selects all streams from an account and the subscribers during that stream
Linq query syntax
Linq extention method syntax
This is the query that gets generated
The text was updated successfully, but these errors were encountered: