select t_subject_no, subject_name,
sum(case when t_totalscore BETWEEN '90' AND '100' then 1 else 0 end),
sum(case when t_totalscore BETWEEN '80' AND '89' then 1 else 0 end),
sum(case when t_totalscore BETWEEN '70' AND '79' then 1 else 0 end),
sum(case when t_totalscore BETWEEN '60' AND '69' then 1 else 0 end),
sum(case when t_degree ='F' then 1 else 0 end),
count(*)
from (select a.*, b.subject_no, b.subject_name from score_total a join subject b on subject_no = t_subject_no join category c on subject_category = c_no) d where (select member_ki from member where d.t_mem_id = member_id) = 1 group by t_subject_no,subject_name order by t_subject_no