MS Access字段作为列 [英] MS Access fields as columns
本文介绍了MS Access字段作为列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在MS Access中进行查询,以便将字段分组为列?
How can you make a query in MS Access, so that the fields are grouped into columns?
通过示例更容易解释.
表格:
Brand Quantity Date
1. MTZ 3 2012.03
2. MTZ 1 2012.03
3. Belor. 2 2012.04
4. YTO 2 2012.04
5. YTO 1 2013.03
我想要这样的查询:
Brand 2012.03 2012.04 2013.03
MTZ 4 0 0
Belor. 0 2 0
YTO 0 2 1
推荐答案
尝试这样
TRANSFORM Sum(tabl1.[Quantity]) AS SumOfQuantity
SELECT tabl1.[brand], Sum( tabl1.[Quantity]) AS [Total Of Quantity]
FROM tabl1
GROUP BY tabl1.[brand]
PIVOT tabl1.[Date];
这篇关于MS Access字段作为列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文