I want to conditionally exclude items from a query of tableA if an ID value for that query is NOT included at least once as a reference value in tableB... Something like this...
Initial query:
var jobs = from j in Jobs select j; // there's more, just keeping it simple...
I have tried these sub-queries...
Optional filtering based on a conditional:
jobs = jobs.Where(j => Bidders.Select(b => b.JobKey == j.JobKey) != null);
OR this:
jobs = jobs.Where(j => Bidders.Select(b => b.JobKey == j.JobKey).Count() > 0);
This does not seem to filter out jobs with no entries in the bidders table... How should I do this???
如果已经没有导航属性,则您与第一种方法有些相似:
jobs = jobs.Where(j => Bidders.Any(b => b.JobKey == j.JobKey));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.