select t1.tagentsid,
       t1.fagentnum,
       t1.fagentname,
       t1.fcontact,
       t1.fagentshortname,
       t1.fprovince,
       t1.fcity,
       t1.fcounty,
       t1.fsaleruserid,
       t2.fname fsaler,
       t1.ftype
from tagents t1
       inner join tenterprise_users t2 on t1.siteid = t2.siteid and t1.fsaleruserid = t2.tenterprise_userid
where t1.siteid =$siteid$ and $where$