select
    case
        when freceptiontimes_first<3 then'<3´Î'
        when freceptiontimes_first>=3 and freceptiontimes_first<=5  then'3-5´Î'
        when freceptiontimes_first>=6 and freceptiontimes_first<=8  then'5-8´Î'
        when freceptiontimes_first>8 then'>8´Î' end fclass,
    count(0)fcount from tcustomer t1
inner join tcustomer_reception t2 on t1.siteid=t2.siteid and t1.tcustomerid=t2.tcustomerid and t1.ffirstorderid=t2.tcustomer_receptid
    and convert(varchar(7),t2.fdate,120)>=$fbegmonth$ and convert(varchar(7),t2.fdate,120)<=$fendmonth$
inner join DSBCRM..tagents t3 on t1.siteid=t3.siteid and t1.tagentsid=t3.tagentsid
where t1.siteid=$siteid$
group by case
             when freceptiontimes_first<3 then'<3´Î'
             when freceptiontimes_first>=3 and freceptiontimes_first<=5  then'3-5´Î'
             when freceptiontimes_first>=6 and freceptiontimes_first<=8  then'5-8´Î'
             when freceptiontimes_first>8 then'>8´Î' end