I think part of your code is cut off. It relies on 1 table, which is not at all.
This is the best I can do with what I see:
var query =
(
from u in Users
from g in u.UsersGroups
from un in g.Units.DefaultIfEmpty()
let t = un.UnitsType
where u.Removed == 0 && (t.Type <> 100 || t.Type == null)
select new { ID = u.IDUsr, Name = u.Name }
).Distinct()
Amy b source
share