Employee id, name, datejoin, deptID
and another table that is
Marketing id, name, deptID
What I am trying to do is search of deptID from Employee table in Marketing to see if it exists, if it doesn't exists want to add name and deptID from Employee table into Marketing table. Basically I believe it is left outer join.
I am trying to do is using lambda expressions and EF I am new to this area so was wondering how to accomplish that. I have created the entities fine need to figure out the lambda expression
tTlEntities sde = new tTlEntities(); sde.t_Marketing.Where(x=>x.deptID == t_Employee.deptID).
That is how far I went I know some outer joining is needed. Help Pleasee
It could be done with a left outer join of employee to marketing and a check for null marketing results for the employee, or you can use not exists which in LINQ to Entities is:
tTlEntities sde = new tTlEntities(); var employeeQuery = sde.t_Employee.Where( e=> !sde.t_Marketing.Any(m => m.deptID == e.deptID));