以下是引用gzh97730在2005-12-29 8:53:00的发言:
建两个查询表:
表一:联合两表的数据
表二:按楼主的格式显示数据
表一<2004Union2005>:
SELECT Customer,date,month(Date) as month, Quantity, 4 AS [year]
FROM Invsale2004
UNION SELECT Customer,date,month(Date) as month, Quantity, 5 AS [year]
FROM Invsale2005;
表二:
TRANSFORM Sum(Quantity) AS sum
SELECT Customer
FROM 2004Union2005
GROUP BY Customer
ORDER BY Format([month],"00") & [year] & Format([date],"mmm")
PIVOT Format([month],"00") & [year] & Format([date],"mmm");
剩下的基本都是由excel来处理了。时间关系不列出来,或者哪位网友可补一下。
可以问一下,楼主是什么职业?
以下是引用accessNew001在2005-12-29 21:58:00的发言:
谢谢WWWWa 你真是个有心人
但是用left jion 有个问题哦 就是如果2004 与2005customer 中的字段不相等就不能查询出来哦
我现在要所有customer
方法很好
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |