Linq query for parent & Child tables with aggregates
Posted on 2010-11-11
I have 2 tables (PTO [Parent] & PTODetails [Child]) that have a 1 to many relationship between them. I would like to get the information from the parent table and some aggregated information from the child table using linq.
If i where using SQL i would write something like this:
Select PTO.ID, Max(PTODetails.RequestDate), Min(PTODetails.RequestDate), PTO.PersonID
From PTO Inner Join PTODetails on PTO.ID = PTODetails.PTOID
Where PTO.RequestDate > GetDate()
How would i go about writting something like that in LINQ?
Thanks in advance...