Okay. Well, in this case we have an Animal table and a Cages table. Unfortunately we have to allow animals to move between multiple cages at a time, so an animal can be in multiple cages, and multiple animals can be in a cage. Not very intuitive, but these are our requirements. Rather than setting up a many-to-many relationship, I found that an animal would not rotate between more than 5 cages at a time, so to the animals table I added IdCage1, IdCage2, ..., IdCage5 to be able to track things in a little finer detail and this way hopefully have a 1-to-many relationship. So we set Animal.IdCage1 as a foreign key to the Cages table which has a Cages.IdCage column.
Now what I am trying to do is create a flat (1-layer) report of all cages and also include data that is related to the animals table (such as the animal pedigree or strain) in the report. So the columns we need are: Cage.IdCage, Cage.CageType, Cage.DateTimeSetup, Animal.Pedigree.PedigreeName.
I thought this would do it, but LET is not supported:
ext = scope.Extent<Cage>();
var result = from c in ext
let StrainIdMale = scope.Extent<Animal>().Where(a => a.IdCage1 == c.IdCage).SingleOrDefault().Strain.StrainId
where c.IsActive == true