select t.fmonth, sum(t.famount) famount
from (
         select convert(varchar(7), fdate, 120) as fmonth, convert(int, SUM(forderamount) / count(0)) as famount
         from DSBCRM..tcustomer_reception t1
         where ftype = 'ÏúÊÛ'
           and siteid =$siteid$
           and tagentsid=$tagentsid$
           and
             convert (varchar (7)
             , fdate
             , 120)>=$fbegmonth$
           and convert (varchar (7)
             , fdate
             , 120)<=$fendmonth$
         group by convert (varchar (7), fdate, 120)
         union all
select fmonth, 0 as famount
from DSBCRM..tmonthlist
where fmonth >=$fbegmonth$
  and fmonth<=$fendmonth$
  and fmonth<= convert (varchar (7)
    , GETDATE()
    , 120)

    ) t
group by t.fmonth
order by t.fmonth