How to SELECT WHERE NOT EXIST using LINQ?

前端 未结 5 806
余生分开走
余生分开走 2020-12-13 23:33

I have to list all \"shift\" data to be assigned to an \"employee\" but shift data must not be included if it is already existing in employ

5条回答
  •  星月不相逢
    2020-12-13 23:50

    How about..

    var result = (from s in context.Shift join es in employeeshift on s.shiftid equals es.shiftid where es.empid == 57 select s)
    

    Edit: This will give you shifts where there is an associated employeeshift (because of the join). For the "not exists" I'd do what @ArsenMkrt or @hyp suggest

提交回复
热议问题