You're on the right track!
On the first look, you have to group data...
See:
How to: Perform Grouped Joins (C# Programming Guide)[
^]
var query = from a in TableA.Where(u=>u.UserId==1)
join b in TableB on a.Id equals b.Id into grp
select new
{
MaxOfCreated = grp.Max(z=>z.CreatedDate),
MaxOfModified = grp.Max(x=>x.ModifiedDate),
Count = grp.Count()
};
Note #1: I do not see your data, so... my query may not meet your requirements...
Note #2: I'd suggest to download
LinqPad[
^], which is very useful in process of query translation from sql to Linq. It's free tool ;)
For further details, please see:
101 LINQ Samples in C#[
^]