score:2
Accepted answer
try below code
var summarypayments = (from s in paymentslist
join alloc in allocationlist on s.id equals alloc.originalid into allocorg
from po in allocorg.defaultifempty()
join allocrev in allocationlist on s.id equals allocrev.reversalid into allocrevs
from pr in allocrevs.defaultifempty()
select new { s, pr }).select(x => { x.s.reversalid = (x.pr != null ? x.pr.reversalid : 0); return x.s; });
Source: stackoverflow.com
Related Query
- How to prepopulate projection result with existing left model in linq left join query
- How do I most elegantly express left join with aggregate SQL as LINQ query
- How to left join multiple tables with LINQ
- how to get all columns from a linq result with a join
- How make LINQ query with GroupBy and LEFT JOIN
- Entity Framework: How to perform left join with EF and LINQ among multiple tables
- How to convert multiple SQL LEFT JOIN statement with where clause to LINQ
- Linq problem when trying a left join projection with multiple records
- How to extract max(property) from left join in LINQ with lambda expression
- Linq to SQL With Left Outer Join and Group By With Sum - How To
- How to convert a SQL with multiple left joins to an Entity Framework LINQ statement using Include methods (No Join methods)?
- How to do a Linq Left Outer Join with a middle table?
- How to perform a left join with an additional filtering in LINQ to entities?
- Populating a model with a LINQ outer join result
- How express SQL left join with IS NULL in LINQ
- How to group by with left join by multiple columns using linq and get count of grouped records?
- how to do left join and >= join condition with linq
- how to create a left join query for a many to many related table with LINQ
- How to handle ViewBag with null values from linq with left outer join in razor view
- Left outer join Linq to Entities with MVC model
- Join an array of string with the result of an existing linq statement
- SQL to Linq with SUM, ISNULL, and Left Join : how to make a good linq query?
- How to convert SQL with LEFT JOIN to EF CORE 3 LINQ
- How do you perform a left outer join with a where clause using linq lambda extension methods
- left join with linq how to
- How to write Linq left join with multiple fields where one is case insensitive
- How do you perform a left outer join using linq extension methods
- LINQ to SQL - Left Outer Join with multiple join conditions
- How do you perform a CROSS JOIN with LINQ to SQL?
- Convert SQL to Linq left join with null
More Query from same tag
- Always Encrypted, LINQ, and Where Contains
- how to query xml using linq or xpath
- Get data of multiple column with same foreign key in C# LINQ
- How to add dynamic sort by direction to NHibernate queryover
- "Found x matching results in y miliseconds" in EF6 LINQ
- Invalidating/Disabling Entity Framework cache
- Nested new result from entity framework query
- Linq query where first column from DataTable is compared to second column for duplicates
- LinqPad, using multiple datacontexts - DevForce
- Select all categories who has items that are active in them?
- LINQ OrderBy not sorting as expected on string
- Registration Admin Approval verification in C# asp dot net MVC
- Linq Get count from multiple where condition
- Query aggregation with List of Objects
- Linq to Entities Group By
- hat is the LINQ equivalent for the following SQL query?
- Tuples vs. Anonymous Types vs. Expando object. (in regards to LINQ queries)
- Use LINQ expressions or Specification pattern to access Ingres database?
- LINQ Query with Hashsets from Entity Data Model
- Performance Optimization for LINQ query in property getter
- mutating the linq query to return the desired results
- Linq sorting of entity by custom property via reflection
- Where contains throw Value can't be null
- RavenDB - Sift through documents and get count using index/query
- How to take array segments out of a byte array after every X step?
- Common Table Expression in EntityFramework
- How to insert LINQ where parameter in cde behind
- Linq to Objects - query objects for any non-numeric data
- linq left join datatable and oder by the nullable value
- Linq distinct based on two columns