| 123456789101112131415161718192021222324252627282930313233 |
- select t1.sys_enterpriseid,
- t1.enterprisename,
- t1.contact,
- t1.address,
- t1.phonenumber,
- t1.province,
- t1.city,
- t1.county,
- t2.sa_agentsid,
- t2.agentnum,
- t2.priceadjustment,
- t2.type,
- CONVERT(t1.grade, CHAR) grade,
- t1.industry,
- t1.taxno,
- t1.saleclassauth,
- t2.signdate,
- t2.createby,
- t2.createdate,
- t2.status,
- t2.parentid,
- (SELECT enterprisename FROM sys_enterprise WHERE sys_enterpriseid = (SELECT sys_enterpriseid FROM sa_agents WHERE sa_agentsid = t2.parentid)) parent_enterprisename,
- t4.erpagentnum,
- t2.isservice,
- t1.limitreturnday,
- t1.freefreightamount,
- t1.invoicingpoint,
- t1.isrebate
- from sys_enterprise t1
- inner join sa_agents t2 on t1.siteid = t2.siteid and t1.sys_enterpriseid = t2.sys_enterpriseid
- LEFT JOIN sys_dataextend t4 ON t1.sys_enterpriseid = t4.ownerid and ownertable='sys_enterprise' and t1.siteid = t4.siteid
- where t1.siteid = $siteid$
- and t2.sa_agentsid = $sa_agentsid$
|