score:2
(from a in activities
join ov in organizationvolunteers on a.organizationid equals ov.organizationid
join av in activityvolunteers
on a.activityid equals av.volunteerid into joinedactvol
from av in joinedactvol.defaultifempty()
where ov.volunteerid==1
select new
{
a.activityid,
a.activityname,
av.activityrole,
a.organizationid,
organizationname = (from o in organizations where o.organizationid == a.organizationid select o.organizationname).firstordefault()
}).union
(from a in activities
join av in activityvolunteers on a.activityid equals av.activityid
where av.volunteerid==1 && a.organizationid == null
select new
{
a.activityid,
a.activityname,
av.activityrole,
a.organizationid,
organizationname = ""
})
Source: stackoverflow.com
Related Query
- Linq Join across three tables
- Inner Join on three tables using Linq
- Linq join three tables orderd by Timstamp
- How to join three tables and put it in a ViewModel using LINQ Lambda in ASP.Net MVC?
- LINQ Query to join three tables
- Looking for a better way to perform Left outer join on three tables in LINQ
- Linq Query with three tables join to send alert after x days
- Linq left outer join across multiple tables retrieving info from each table
- Join three tables using LINQ
- How to join three tables in linq with child table sum
- How to perform Join between multiple tables in LINQ lambda
- LINQ to SQL multiple tables left outer join
- Select All columns for all tables in join + linq join
- Joining three tables and using a left outer join
- How to join tables in EF LINQ
- How to join 3 tables with linq
- Linq group by multiple fields across different tables
- How to left join multiple tables with LINQ
- Join tables in SQLite.Net with LINQ on xamarin.android is not supported
- Multiple tables left join using Linq
- linq query to join two tables and get the count from one table values from the other
- Left outer join using LINQ -- understanding the code
- How to reuse a linq expression for 'Where' when using multiple source tables
- NHibernate 3 LINQ inner join issue with three jumps: NotSupportedException
- LINQ Source Code Available
- LINQ to Entities three table join query
- LINQ to SQL and Join two tables with OR clause
- Why do these three pieces of LINQ code produce different (or erroneous) results?
- using linq with join using two where on two tables
- linq join 3 tables with or condition
More Query from same tag
- Group by an array inside an array using Linq
- Accessing entities with navigation properties using Linq in Web Api and EF
- How can i make this Linq Statement more sophisticated
- Check existence of a record before returning resultset in LINQ to SQL
- How to group dates by week?
- Can C# / Linq add an XAttribute to a XElement after the XElement.Remove() has been invoked?
- how to compare a list type of object with list type int
- Check if XML element exist using LINQ
- How to parameterize a selector with a function in EF query?
- How to call List in LINQ?
- EntityFramework/LINQ - get filtered content from associated table/type
- LINQ to XML Query in VB
- Get node value xml with LINQ c#
- How to select with multiple condition in linq?
- assign value to a new list using linq
- Linq update record
- How to get sum of hours and minutes in sql
- Is there a way to speed up this code that finds data changes in two XML files?
- How can i have a linq result set returned as a custom type
- Entity Framework 6 vs Dapper vs stored procedure vs request in SQL Server
- LINQ Query - Selecting a key based upon the value having a property that matches a string?
- LINQ GroupBy and Distinct
- LINQ to Entities does not recognize method inside an Expression
- c# Entity Framework select into derived child
- read xml file by linq
- AutoMapper ProjectTo fails with FirstOrDefault
- Get all elements but the first from an array
- How to look at sql generated by EntityFramework when Count is used
- Conditional Lambda Foreach
- LINQ expression with multiple methods