I want to select the persons only who are having pets.
when I execute the query
var query = from p in people
join
Here's a different way to do it, adding only one line:
var query = from p in people
join pts in pets
on p equals pts.Owner into grp
where grp.Any() // <--- added this
select new {grp=grp,PersonName=p.FirstName};
Here I select the groups, as you do, but I added one line that selects only the groups that contain at least one element, and ignore the rest.