select fname,count(0)ftotalcount,
       count(case when fgrade='A'then 1 end)A_count,
       count(case when fgrade='B'then 1 end)B_count,
       count(case when fgrade='C'then 1 end)C_count from DSBCRM..tbusinesstrip
where siteid=$siteid$ and tenterprise_userid in $tenterprise_userid$ and
    fgrade is not null and
    convert(varchar(7),fbegdate,120)>=$fbegmonth$ and convert(varchar(7),fbegdate,120)<=$fendmonth$
group by fname
order by convert(float,count(case when fgrade='A'then 1 end))/convert(float,count(0))desc,
    convert(float,count(case when fgrade='B'then 1 end))/convert(float,count(0)) desc,
    convert(float,count(case when fgrade='C'then 1 end))/convert(float,count(0))desc,
    fname