|
@@ -14,7 +14,8 @@ SELECT t1.sa_accountbalanceid,
|
|
|
t2.sa_accountclassid,
|
|
|
t2.accountno,
|
|
|
t2.accountname,
|
|
|
- t4.agentnum
|
|
|
+ t4.agentnum,
|
|
|
+ t5.areaname
|
|
|
FROM sa_accountbalance t1
|
|
|
LEFT JOIN sa_accountclass t2 ON t1.sa_accountclassid = t2.sa_accountclassid
|
|
|
AND t1.siteid = t2.siteid
|
|
@@ -22,5 +23,7 @@ FROM sa_accountbalance t1
|
|
|
AND t1.siteid = t3.siteid
|
|
|
LEFT JOIN sa_agents t4 ON t1.sys_enterpriseid = t4.sys_enterpriseid
|
|
|
AND t1.siteid = t4.siteid
|
|
|
+ left join (select t1.sys_enterpriseid,t1.siteid,GROUP_CONCAT(t2.areaname) areaname from sys_enterprise_tradefield t1 inner join sa_salearea t2 on t1.sa_saleareaid=t2.sa_saleareaid and t1.siteid=t2.siteid group by t1.siteid, t1.sys_enterpriseid
|
|
|
+) t5 on t1.sys_enterpriseid=t5.sys_enterpriseid and t1.siteid=t5.siteid
|
|
|
WHERE ($where$)
|
|
|
and t1.siteid = $siteid$
|