This question is locked. New answers and comments are not allowed.
I'm trying to figure out how to write a LINQ statement where in SQL I would use LEFT JOINs with multiple join columns. My persistent objects are reverse engineered from an existing database. The tables look like this:
Package detail table:
package_detail_id (pk)
group_id (fk)
item_id (fk)
lookup_item_type_id (fk)
....
Lookup item type table:
lookup_item_type_id (pk)
description
...
I need to get all lookup item types that are *not* already in the package detail table for a given group id and item id. This is how I would write the SQL query:
SELECT IT.*
FROM lookup_item_type IT
LEFT JOIN package P
ON IT.lookup_item_type_id = P.lookup_item_type_id
AND P.group_id = ??? (given group id value)
AND P.item_id = ??? (given item id value)
WHERE P.package_id IS NULL
Can anyone suggest how to write a LINQ statement that covers this scenario?