Joins and subqueries in LINQ

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2010-03-15T21:11:30Z Indexed on 2010/03/15 21:39 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

I am trying to do a join with a sub query and can't seem to get it. Here is what is looks like working in sql. How do I get to to work in linq?

SELECT po.*, p.PermissionID
FROM PermissibleObjects po
 INNER JOIN PermissibleObjects_Permissions po_p ON (po.PermissibleObjectID = po_p.PermissibleObjectID)
 INNER JOIN Permissions p ON (po_p.PermissionID = p.PermissionID)
 LEFT OUTER JOIN
  (
  SELECT u_po.PermissionID, u_po.PermissibleObjectID
  FROM Users_PermissibleObjects u_po
  WHERE u_po.UserID = '2F160457-7355-4B59-861F-9871A45FD166'
  ) used ON (p.PermissionID = used.PermissionID AND po.PermissibleObjectID = used.PermissibleObjectID)
WHERE used.PermissionID is null

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ