|
@@ -10,7 +10,15 @@ SELECT
|
|
|
t1.changeby,
|
|
|
t1.changedate,
|
|
|
t1.checkby,
|
|
|
- t1.checkdate
|
|
|
+ t1.checkdate,
|
|
|
+ t3.sys_enterpriseid,
|
|
|
+ t4.agentnum,
|
|
|
+ t5.abbreviation,
|
|
|
+ t5.enterprisename
|
|
|
FROM
|
|
|
- sa_creditbill t1
|
|
|
+ sa_creditbill t1
|
|
|
+ left join (select sa_creditbillid,siteid,min(sa_creditbilldetailid) sa_creditbilldetailid from sa_creditbilldetail group by sa_creditbillid,siteid) t2 on t1.sa_creditbillid=t2.sa_creditbillid and t1.siteid=t2.siteid
|
|
|
+ left join sa_creditbilldetail t3 on t2.sa_creditbilldetailid=t3.sa_creditbilldetailid and t2.siteid=t3.siteid
|
|
|
+ left join sa_agents t4 on t4.sys_enterpriseid=t3.sys_enterpriseid and t4.siteid=t3.siteid
|
|
|
+ left join sys_enterprise t5 on t5.sys_enterpriseid=t3.sys_enterpriseid and t5.siteid=t3.siteid
|
|
|
where t1.sa_creditbillid=$sa_creditbillid$
|