select t1.fname,count(distinct t1.tbusinesstripid)tripcount,count(t2.tworkmxid)count from DSBCRM..tbusinesstrip t1
left join DSBCRM..tworkmx t2 on t1.siteid=t2.siteid and t1.tbusinesstripid=t2.tbusinesstripid
where t1.siteid=$siteid$ and
convert(varchar(7),t1.fbegdate,120)>=$fbegmonth$ and convert(varchar(7),t1.fbegdate,120)<=$fendmonth$
and t2.fworkname='تص¼¯·½·¨'
group by t1.fname
order by convert(float,count(t2.tworkmxid))/convert(float,count(distinct t1.tbusinesstripid))desc,t1.fname