能在下面的查询的儿童表的栏中适用条件吗?Linq-在儿童表的条件
病人是主表,我需要补充下面,其中有一列条件评估表像
Where(a => a.Date >= startdate && a.Date < stopdate && a.patient.assess.column1 == 10)
完整的查询
=> dc.Patient
.Include("first")
.Select(a => new
{
Patient = a,
Date = a.Assess.Max(x => x.Date),
M3 = a.M3,
Assess = a.Assess,
Details = a.Assess
.Select(x => new
{
x.Key,
x.Team
})
})
.Where(a => a.Date >= startdate && a.Date < stopdate)
.OrderBy(a => a.Date)
.Take(batchSize)
.ToList()
);
一对多的关系吗?如果其中一个孩子的价值是10而另一个孩子的价值是20呢?你想在查询中包含父项吗? –
如果您只想让任何孩子的值为10,则可以使用以下条件:'a.Assess.Any(x => x.column1 == 10)'。 –