I have to following LINQ query, where I look for some different timestamps in an DB:
var issues =
from i in ReadOnlyContext.Issues
where i.TruckID == truckID && i.OutOfOrderStart < startDate &&
i.OutOfOrderEnd > endDate ||
i.TruckID == truckID && i.OutOfOrderStart > startDate &&
i.OutOfOrderEnd < endDate ||
i.TruckID == truckID && i.OutOfOrderStart < startDate &&
i.OutOfOrderStart < endDate ||
i.TruckID == truckID && i.OutOfOrderStart > startDate &&
i.OutOfOrderEnd > endDate
select i;
My problem is that I would like to filter the query, to only return entries, where OutOfOrderStart and OutOfOurderEnd is from the same row. How can I accomplish this?