select t2.fname as fworkername,
       t1.fname,
       t1.fphonenumber,
       t1.fcommunity,
       t1.fhouseunit,
       t1.fhousenumber,
       t1.createdate,
       t1.fnotes,
       t3.fagentname,
       t3.fagentshortname,
       t3.fprovince,
       t3.fcity,
       t3.fcounty,
       t4.fname                                                                                         as fsaler
from tagents_workersubmit t1
         inner join tagents_workers t2 on t1.siteid = t2.siteid and t1.tagentsid = t2.tagentsid and
                                          t1.tenterprise_userid = t2.tenterprise_userid
         inner join tagents t3 on t1.siteid=t3.siteid and t1.tagentsid=t3.tagentsid
         left join tenterprise_users t4 on t3.siteid = t4.siteid and t3.fsaleruserid = t4.tenterprise_userid
where t1.siteid = $siteid$ and $where$ and t1.fismodify=0