How can I convert the below SQL statement to Linq:
SELECT A.Application, B.Filter
FROM Applications A left join Filters B on A.Application = B.Filter OR
B.Filter is null
I have written the following but am unable to figure out how to add "OR B.Filter is NULL" to it:
var filteredApproved = (from f in
(from a in Applications
join b in Filters on a.Application equals b.Filter into rss
from ss in rss.DefaultIfEmpty()
select new {
a.Application,
Filter = (b == null ? 0: b.Filter)
})
For example, if the Applications and Filter table are as below:
Application
---------
A
B
Filter
--------
A
null
I am wanting the following result
Application Filter
--------- ------
A A
A null
B null
The Linq query returns:
Application Filter
--------- ------
A A
B null
It does not return the second row that SQL is returning. I need to add " OR B.Filter is NULL" to linq.