How to get a statistic matrix

Hello,
I want a statistic matrix in this form, how can I achieve it?

To detail it, I have 1 million users which schema is
{
userid: string
school: string
}

and about 1k logs for each user, which schema is
{
userid:string
operateid: string
operatetype: string
}

There are 10s of optype, and I want to know what users of each school is operating, so the matrix is

                OperateA                 OperateB                    OperateC

SchoolA
SchoolB
SchoolC