|
谢谢!这个问题终于解决了 Sql = "SELECT e.e2,e.e3,d.d2,d.d3,b.b2,b.b3,c.c2,c.c3 FROM " & _
"((([1$]a left join" & _
"(select 客户名称 as c1,sum(数量) as c2,sum(价税合计) as c3 from [销售发票序时簿$] where 单据日期 between '2013-01-01' and '2013-03-31'group by 客户名称) c on c.c1=a.客户名称) " & _
" left join (select 客户名称 as b1,sum(数量) as b2,sum(价税合计) as b3 from [销售发票序时簿$] where 单据日期 between '2012-10-01' and '2012-12-31'group by 客户名称) b on b.b1=a.客户名称) " & _
" left join (select 客户名称 as d1,sum(数量) as d2,sum(价税合计) as d3 from [销售发票序时簿$] where 单据日期 between '2012-07-01' and '2012-09-30'group by 客户名称) d on d.d1=a.客户名称) " & _
" left join (select 客户名称 as e1,sum(数量) as e2,sum(价税合计) as e3 from [销售发票序时簿$] where 单据日期 between '2012-04-01' and '2012-06-30'group by 客户名称) e on e.e1=a.客户名称"
Sheets("1").Range("D2").CopyFromRecordset xx.Execute(Sql) |
|