var possibleTPMs = (from ui in db1.Users
from org in db2.Orgs.Where(o => o.OrgId == ui.OrgId && !o.DeletedFlag).DefaultIfEmpty()
where !ui.DeletedFlag && ui.ActiveFlag && ui.OrgId == 1 && ui.UserId != 1
select new { ui.UserId, ui.LastName, ui.FirstName }).ToList();
Above is sample LINQ but having an errors, How can I join these two tables that came from two different database.
To join two 'tables' you simply join them with the below syntax. You shouldn't need any complex join using wheres
var possibleTPMs = (from ui in db1.Users join org in db2.Orgs on ui.id equals org.id select new { ui.UserId, ui.LastName, ui.FirstName }).ToList();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.