score:2

Accepted answer
goals = await _context.fixtureactivitytb.where(p => p.activitytype.trim() == "g")
                      .groupby(p => p.playerid)
                      .join(_context.playertb, x => x.key, j => j.playerid, (x, j)
                          => new stats
                             {
                                name = j.givenname,
                                pid = j.playerid,
                                teamid = j.teamid,
                                count = x.count()
                             })
                      .orderbydescending(s => s.count)
                      .thenby(s => s.name)
                      .take(10)
                      .tolistasync();

score:0

var q = from p in _context.fixtureactivitytb 
        where p.activitytype.trim() == "g" 
        group p by p.playerid into x 
        join j in _context.playertb on x.key equals j.playerid 
        select new stats 
        { 
            name = j.givenname, 
            pid = j.playerid, 
            teamid = j.teamid, 
            count = x.count() 
        };

goals = await q.orderbydescending(s => s.count)
               .thenby(s => s.name)
               .take(10)
               .tolistasync();

Related Query

More Query from same tag