MS Access字段作为列

与标准

如何在MS Access中进行查询,以便将字段分组为列?

通过示例更容易解释。

桌子:

        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];

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章