|
@@ -5,6 +5,8 @@ with sa_salestarget as (
|
|
|
)
|
|
)
|
|
|
SELECT DISTINCT m.year,
|
|
SELECT DISTINCT m.year,
|
|
|
m.sys_enterpriseid,
|
|
m.sys_enterpriseid,
|
|
|
|
|
+ t2.agentnum,
|
|
|
|
|
+ t1.enterprisename,
|
|
|
m1.target_l + m2.target_l + m3.target_l + m4.target_l + m5.target_l + m6.target_l +
|
|
m1.target_l + m2.target_l + m3.target_l + m4.target_l + m5.target_l + m6.target_l +
|
|
|
m7.target_l + m8.target_l + m9.target_l + m10.target_l + m11.target_l +
|
|
m7.target_l + m8.target_l + m9.target_l + m10.target_l + m11.target_l +
|
|
|
m12.target_l y1l,
|
|
m12.target_l y1l,
|
|
@@ -56,4 +58,6 @@ from sa_salestarget m
|
|
|
LEFT JOIN sa_salestarget m10 ON m10.year = m.year and m10.point = 10 and m.sys_enterpriseid = m10.sys_enterpriseid
|
|
LEFT JOIN sa_salestarget m10 ON m10.year = m.year and m10.point = 10 and m.sys_enterpriseid = m10.sys_enterpriseid
|
|
|
LEFT JOIN sa_salestarget m11 ON m11.year = m.year and m11.point = 11 and m.sys_enterpriseid = m11.sys_enterpriseid
|
|
LEFT JOIN sa_salestarget m11 ON m11.year = m.year and m11.point = 11 and m.sys_enterpriseid = m11.sys_enterpriseid
|
|
|
LEFT JOIN sa_salestarget m12 ON m12.year = m.year and m12.point = 12 and m.sys_enterpriseid = m12.sys_enterpriseid
|
|
LEFT JOIN sa_salestarget m12 ON m12.year = m.year and m12.point = 12 and m.sys_enterpriseid = m12.sys_enterpriseid
|
|
|
|
|
+ LEFT JOIN sys_enterprise t1 on t1.sys_enterpriseid=m.sys_enterpriseid
|
|
|
|
|
+ LEFT JOIN sa_agents t2 on t1.sys_enterpriseid=t2.sys_enterpriseid and t1.siteid=t2.siteid
|
|
|
ORDER BY m.year desc
|
|
ORDER BY m.year desc
|