标题: MS-Access (Jet-SQL)的union all 问题 [打印本页] 作者: leopard12345 时间: 2009-1-24 10:02 标题: MS-Access (Jet-SQL)的union all 问题 MS-ACCESS是JET-SQL,不支持UNION ALL
下图333是我的需求:
我做了两个例子:
1。SELECT [1].MATERIAL,[1].USD200801,[1].USD200802,[1].USD200803,[2].USD200804
FROM 1 LEFT JOIN 2 ON [1].Material=[2].Material
UNION SELECT [1].MATERIAL,[1].USD200801,[1].USD200802,[1].USD200803,[2].USD200804
FROM 1 RIGHT JOIN 2 ON [1].Material=[2].Material;
2. SELECT *
FROM 1 LEFT JOIN 2 ON [1].Material=[2].Material
UNION SELECT *
FROM 1 RIGHT JOIN 2 ON [1].Material=[2].Material;
感谢!作者: Henry D. Sy 时间: 2009-1-24 10:16
SELECT [1].MATERIAL,[1].USD200801,[1].USD200802,[1].USD200803,Null as USD200804
FROM [1]
UNION ALL SELECT [2].MATERIAL, Null,Null,Null,[2].USD200804
FROM [2]作者: Henry D. Sy 时间: 2009-1-24 10:18
问题出在连接而不是联合作者: Henry D. Sy 时间: 2009-1-24 10:26
然后,再分组汇总即可