SELECT 导购员,SUM(TCE) FROM (
select *,销售数量*单价*iif(MID(所属类型,1,1)='A',A类商场提成系数,IIF(MID(所属类型,1,1)='B',B类提成系数,C类提成系数)) as tce from (
SELECT *
FROM Sheet2 INNER JOIN Sheet4 ON Sheet2.所在商场 = Sheet4.商场名称) a left join sheet3 b on
a.销售商品名称=b.销售商品名称) GROUP BY 导购员