Multiple left joins fail to work
See original GitHub issueUsing LinqToDB 1.7.6 and a Firebird database. Trying to run a query like:
select *
from shops
left join organizations on ...
left join ocrconfig on ...
C# LINQ code:
var list = (from shop in shops
join org in orgs on shop.OrganizationId equals org.Id into orgGroup
join ocr in ocrTable on shop.CustomerNumber equals ocr.CustomerNumber into ocrGroup
from ocrItem in ocrGroup.DefaultIfEmpty()
from orgItem in orgGroup.DefaultIfEmpty()
select new OrgShopPairAdminPn { ShopPn = shop, Organization = orgItem, OcrConfig = ocrItem });
Result: Table not found for ‘LinqToDB.SqlQuery.SelectQuery+Column’
If I only have one left join all is well:
var list = (from shop in shops
join org in orgs on shop.OrganizationId equals org.Id
join ocr in ocrTable on shop.CustomerNumber equals ocr.CustomerNumber into ocrGroup
from ocrItem in ocrGroup.DefaultIfEmpty()
select new OrgShopPairAdminPn { ShopPn = shop, Organization = org, OcrConfig = ocrItem });
Unfortunately I need left joins here.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Multiple left joins leading to logical error - sql
I am trying to develop a query that counts certain values for multiple tables. The query works fine when I am taking the...
Read more >Query with two LEFT JOIN's is not working as expected
@joanolo Both subqueries create a recordset with one record for every user_id . The left join should make it work when no transfers...
Read more >Access SQL: trouble with nested LEFT JOIN and multiple ...
I would like to do a left join using 2 field comparisons, but I can't get it to work, at least when there...
Read more >How to LEFT JOIN Multiple Tables in SQL
An INNER JOIN will drop records not found on both sides of the join, and you might lose all the records you want...
Read more >Multiple Left Joins Syntax for Custom SQL
The error seems to be in my JOIN syntax, but I am not very good in SQL and can't figure it out. Any...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This looks like the bug & smells like the bug. Should be reproduced & fixed
Looks like we accidentally fixed it at some point. Works in preview2