|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
SELECT "期初","无记录" as 单据日期,JBZL.商品代码 + "|" + JBZL.商品名称 as 商品规格,"无记录" as 机器号,
期初数 as 数量1,0 as 数量2,0 as 数量3,0 as 数量4,吊牌价 * 期初数 as 金额1,0 as 金额2,0 as 金额3,0 as 金额4 FROM [基本资料$] JBZL
right join (select * from [销售$] XS1 on JBZL.商品代码=XS1.商品代码)
right join (select * from [进货$] JH1 on JBZL.商品代码=JH1.商品代码)
right join (select * from [出货$] CH1 on JBZL.商品代码=CH1.商品代码)
UNION ALL
SELECT "销售",单据日期,商品代码 + "|" + 商品名称 as 商品规格,机器号,
0 as 数量2,数量 as 数量1,0 as 数量3,0 as 数量4,0 as 金额2,总金额 as 金额1,0 as 金额3,0 as 金额4 FROM [销售$] XS
UNION ALL
SELECT "进货",单据日期,商品代码 + "|" + 商品名称 as 商品规格,机器号,
0 as 数量3,0 as 数量2,数量 as 数量1,0 as 数量4,0 as 金额3,0 as 金额2,总金额 as 金额1,0 as 金额4 FROM [进货$] JH
UNION ALL
SELECT "出货",单据日期,商品代码 + "|" + 商品名称 as 商品规格,机器号,
0 as 数量4,0 as 数量2,0 as 数量3,数量 as 数量1 ,0 as 金额4,0 as 金额2,0 as 金额3,总金额 as 金额1 FROM [出货$] CH
谢谢谢谢
|
|