Reputation: 3780
I have my Table1 that contains the following columns.
My Table2 contains
I am currently getting all the rows from Table1 that are in a date range as follows:
dbRowList = context.Table1.Where(x => x.dateTime > from && x.dateTime < to).ToList();
However, I would like to also get only the rows that, for the same idCycle
in Table2 (=id of Table1), have the 'label' field with certain string content.
How to join it or query it using LINQ?
Upvotes: 1
Views: 861
Reputation: 51195
Table1.id
= Table2.idCycle
.var result = (from a in context.Table1
join b in context.Table2 on a.id equals b.idCycle
where (a.dateTime > from && a.dateTime < to)
and b.label = /* Value for Label to filter */
select a
)
.ToList();
Upvotes: 1