I’m trying to a LINQ query, and I have been stumped for some time. I tried looking up the documentation, and around here, but I can’t quite seem to find enough pieces to make the whole thing.
If I were to be writing this in SQL, the query would be
SELECT *
FROM (Person JOIN Event ON Person.ID = Event.PersonID) as t
Where (Event.Type = "Invitation") AND !Exists(SELECT *
FROM Event
WHERE Event.Type = "Something"
AND Event.Conference = "someString"
AND t.ID = Event.PersonID)
Any input would be greatly appreciated, even if you only have a solution for part.
Your Event table appears to have a foreign key to Person. This seems unusual as it would imply that an Event can only have one person. I’m going to assume that your Event table is the many-many table in this model. Assuming you have an association between People and Events (PeopleEvents?), you should be able to do this with something like the following (using !Any in place of !Exists):
(note, you may want to project into some other structure here rather than projecting the select many I’m showing here.) If we had more information about your model or what you are trying to accomplish, we might be more help.