sql - How to use null in join condition in linq -
sql - How to use null in join condition in linq -
i having problem in translating sql statement linq query. have not found way how utilize null in bring together status or. here sample sql statement:
select a.* tablea bring together tableb b on (a.id = b.id) or a.id null
what equivalent linq statement? looking bring together status same 1 in above sql statement.
from in tablea bring together b in tableb on ??? equals ??? select a;
i have searched existing post apparently couldn't find 1 on specific issue. thanks.
join
s pretty picky, can utilize them specific things. however, it's easy same result nested from
statements:
from in tablea b in tableb a.id == b.id or a.id == null select a;
also, depending on info you're trying find, may more appropriate query:
from in tablea a.id == null || tableb.any(b => b.id == a.id) select a;
sql .net linq
Comments
Post a Comment