select t1.sa_paybillid, t1.sys_enterpriseid, t1.billno, t1.payer, t1.paydate, t1.period, t1.amount, t1.status, t1.remarks, t1.createby, t1.createdate, t1.bank, t1.bankcardno, t2.agentnum, t3.enterprisename, t3.abbreviation, t1.inbank, t1.inbankcardno from sa_paybill t1 left join sa_agents t2 on t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid left join sys_enterprise t3 on t1.siteid = t2.siteid and t1.sys_enterpriseid = t3.sys_enterpriseid where t1.siteid = $siteid$ and t1.sa_paybillid = $sa_paybillid$