score:1
Accepted answer
var combined = from c in careplans
where c.patientid = 'e4a1da8b-f74d-4417-8ac7-b466e3b3ffd0'
from lr in latestreferral.where(r => r.careplanid == c.careplanid).defaultifempty()
from p in patients.where(patient => patient.patientid == ((lr != null) ? lr.latestreferral.patientid : -1)).defaultifempty()
select new { c.careplanid, patientname = (p == null) ? "no patient" : p.patientname, latestreferral = (lr == null) ? null : lr.latestreferral };
Source: stackoverflow.com
Related Query
- How can I implement a LEFT OUTER JOIN in LINQ using lambda syntax on Entity Framework Core 2.0?
- Linq to SQL With Left Outer Join and Group By With Sum - How To
- How can I create SQL that does a Left Outer Join and also a count from another table?
- How do I convert this SQL outer join to LINQ
- How to use left outer join in LINQ for SQL query?
- How can i do this SQL in Linq? (Left outer join w/ dates)
- how to convert a sql query into linq LEFT OUTER JOIN
- How do you perform a left outer join using linq extension methods
- LINQ to SQL - Left Outer Join with multiple join conditions
- LINQ to SQL Left Outer Join
- LINQ to SQL multiple tables left outer join
- How to limit a LINQ left outer join to one row
- How do I most elegantly express left join with aggregate SQL as LINQ query
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- How can I use Left join in linq that we use in sql?
- EF Linq to Entities calling ToList() on entity set generates SQL command containing multiple left outer join
- Unable to convert SQL Query to LINQ Query for Left Outer Join
- How can I code an outer join using LINQ and EF6?
- How to write a LEFT OUTER JOIN where the right side is null in LINQ to SQL?
- How to add left outer join to grouped and summed LINQ query
- LINQ to Sql Left Outer Join with Group By and Having Clause
- Left Outer Join in Linq to Entities / SQL
- How to perform left outer join in Linq
- Linq to SQL Left Outer Join Not
- How can I convert this SQL to LINQ
- C# - from SQL to Linq - Left Outer Join/Inner Join
- How to left outer join for two unequal lists in linq
- How to convert multiple SQL LEFT JOIN statement with where clause to LINQ
- How can I force LINQ to SQL to perform an INNER JOIN on a nullable foreign key?
- LEFT OUTER JOIN in Linq - How to Force
More Query from same tag
- Return the element of a list which fulfills a certain condition
- Haversine LINQ distance between geo locations
- How can I get a selected item from a Linq query in a variable
- linq: from object in an object to just an object
- How can I convert a string[] into a dictionary<int, string> using a separate int[] as the key set?
- Skip first row in a Matrix, and validate width/height
- Resharper conver to LINQ bug? Or is my code wrong
- EF 5.0 Simple Delete Statement
- Group DateTime by year and month then order it
- could not resolve property (complex properties)
- LINQ - how to remove duplicate rows in table
- How to compare two string arrays and store the matching values in another string array?
- Remove Empty Element using XDocument
- C# Linq - Create a dynamic select query based on user input
- Extension method with optional generic argument
- LINQ custom class query with parameters select
- How convert to linq request?
- Check if List<T> element contains an item with a Particular Property Value
- Is FirstOrDefault/First and OrderByDescending, quicker than LastOrDefault/Last and OrderBy?
- Max return value if empty query
- LINQ Distinct with EqualityComparer<T>.Default: IEquatable<T> implementation ignored?
- How to extract from a list based on user input
- Where to store my Dictionary
- Sum of a particular column using LINQ
- Adding WHERE to a Simple LINQ Query returns zero results (but shouldn't)
- How to Use DocumentDb, LINQ, and F# to return multiple properties?
- Using LINQ, select first of each group, create new obj with specific columns
- Use Group By in order to remove duplicates
- Correct MS Access Query / Linq to use
- Trying to Customize OrderBy with IQueryable - "Skip" method error