Hey I just got an idea I don’t know wether it works or not
I assumed say 4 classes class xx,yy,zz,mm and 4 students A, B,C,D
The data you have is
Calss student
xx A
xx C
yy A
yy D
zz C
mm B
You want is
yy mm
xx 1 0
zz 0 0
IF this is the scenario
In the query create 2 data...