I would like to transpose attendance sql table as below
To the following
Please help me here
Thanks Sara
I would like to transpose attendance sql table as below
To the following
Please help me here
Thanks Sara
In MySQL, you would do this using conditional aggregation:
select pname,
sum(case when weekday = 'Monday' then days else 0 end) as M,
. . .,
sum(days) as Total
from t
group by pname;
Put the logic in the for the rest of the weekdays where . . .
is.