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 employee's data. Let's see the image sample.
This query solves the problem. I found this here:
Scott's Blog
select * from shift where not exists (select 1 from employeeshift where shift.shiftid = employeeshift.shiftid and employeeshift.empid = 57);
Let's see the result:
Now my question is, how could I make this in linQ ? I'm using entity framework.
Hope someone could help. Thanks a lot!!!
from s in context.shift where !context.employeeshift.Any(es=>(es.shiftid==s.shiftid)&&(es.empid==57)) select s;
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With