Select from two tables using "NOT IN" in LINQ in Entity Framework

entity-framework, entity-framework-4, linq, linq-to-sql

Solution

You can do something like this with `Contains`:

var result = from item in ServiceItem
    where !TaggedServiceItems.Contains(item.SKU)
    select item;

Problem

i have the following SQL, how can i implement that in LINQ, i am using Entity framework in my MVC project. ``` SELECT * FROM Catalog.ServiceItem WHERE SKU NOT IN (SELECT ServiceItemSKU FROM Catalog.TaggedServiceItems) ``` Any Ideas ? EDIT: ANSWER: ``` var untaggedItems = from item in serviceItems where !taggedServiceItems.Contains(item.SKU) select item; ```

Original source