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
name sub1 sub2 jhon 1 1 toni 0 1 danial 1 1 jafer 1 0
select name, SUM(CASE WHEN subject = 'sub1' and attendance = 1 THEN 1 ELSE 0 END) as sub1, SUM(CASE WHEN subject = 'sub2' and attendance = 1 THEN 1 ELSE 0 END) as sub2 from Table1 group by name
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)