select t1.ftype, t1.ftypemx, t1.saorderid, t1.fsonum, convert(varchar(10), t1.fdate, 120) fdate, t1.fcontact, t1.fprovince,t1.fcity,t1.fcounty, t1.faddress, t1.fnotes, convert(varchar, t1.submitdate, 120) submitdate, convert(varchar, t1.needdatereplydate, 120) needdatereplydate, convert(varchar, t1.needdateconfirmdate, 120) needdateconfirmdate, convert(varchar, t1.checkdate, 120) checkdate, convert(varchar, t1.closedate, 120) closedate, t1.fstatus, t1.fagentnum, t1.fagentshortname, t1.fbrand, t1.fieldname, t1.fsaler, t3.displayname fsalername,--ÇøÓò¾­ÀíÃû³Æ t1.fiswuliao, t1.fpayagentnum, t4.fagentname as fpayagentname, t4.fagentshortname as fpayagentshortname, t1.frecagentnum, t5.fagentname as frecagentname, t5.fagentshortname as frecagentshortname, t1.fprojectnum, t6.fprojectname, t7.fwriteofstatus, t7.finvoicestatus from saorder t1 left join pp_hr t3 on t1.fsaler = t3.hrid left join tagents t4 on t1.fpayagentnum = t4.fagentnum and t1.siteid = t4.siteid left join tagents t5 on t1.frecagentnum = t5.fagentnum and t1.siteid = t5.siteid left join tproject t6 on t1.fprojectnum = t6.fprojectnum and t1.siteid = t6.siteid left join saorder_view1 t7 on t1.saorderid = t7.saorderid where t1.fstatus!='ɾ³ý'and t1.fagentnum =$fagentnum$ and $where$ and t1.siteid=$siteid$