SELECT *
FROM [Group] g
INNER JOIN User2Group ug
**on g.Id != ug.GroupId**
INNER JOIN [Activity] a
on a.Id = g.ActivityId
WHERE g.UserId != 2
AND a.Lineage like '0,1,%'
Group > 1-n > User2Group < n-1 < User m-n relationship
Activity > 1-n > Group 1-n
Trying to get all groups that a user has not already added to their account.
What I have so far:
var groups = repository.SimpleQuery<Group>("from Group as g join fetch g.Users as u join fetch g.Activity as a where g.Type != ? and a.Lineage like ? and g.CreatedBy.Id != ?", Group.GroupType.Deleted, string.Format("{0}%", lineage), currentUser.Id);
What has me tripped up is the "on g.Id != ug.GroupID"