I have one table like below here I need to get subject
row as column and attendance
as rows
sid name subject attendance
1 jhon sub1 1
2 toni sub1 0
3 danial sub1 1
4 jafer sub1 1
5 jhon sub2 1
6 toni sub2 1
7 danial sub2 1
8 jafer sub2 0
According to my requirements I need to get the output like the following table :
name sub1 sub2
jhon 1 1
toni 0 1
danial 1 1
jafer 1 0
I am new at writing queries in mysql. Thanks in advance for your help!