Working with Entity Framework, but that\'s probably irrelevant If I have an Iqueryable, how do I filter a sub list and keep it IQueryable so it doesn\'t yet hit the DB?
If you want to filter children down to where there's only one child per parent, you need to start with children, select their parents, and do not touch the parents' subitems:
IQueryable childItems = context
.SubItems.Include("Item")
.Where(si => si.Id == 1 && si.Item.SomeAttr == someValue);
// ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// | |
// | Set a condition on the parent
// Set a condition on the child
I assume that each sub-item has a link "pointing" back at its parent.