最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp+access按年,按月统计数据
时间:2022-06-29 13:50:08 编辑:袖梨 来源:一聚教程网
/*
字段:d_id(自动编号), d_je(货币型),d_sxrq(日期型)
表数据如下:
d_id d_je d_sxrq
1 20 2009-5-1
2 30 2009-5-6
3 10 2009-6-5
4 15 2009-6-25
5 5 2009-8-8
6 50 2009-9-9
7 20 2010-5-1
8 40 2010-5-6
9 15 2010-6-5
10 25 2010-6-25
11 55 2010-8-8
12 65 2010-9-9
想按年按月来统计:
如果选择2009年得到
月份 1 2 3 4 5 6 7 8 9 10 11 12
金额 0 0 0 0 50 25 0 5 50 0 0 0
如果选择2010年得到:
月份 1 2 3 4 5 6 7 8 9 10 11 12
金额 0 0 0 0 60 40 0 55 65 0 0 0
*/
Select Year(D_SXRQ) As Y,
Sum(IIF(Month(D_SXRQ) = 1, D_JE, 0)) As M01,
Sum(IIF(Month(D_SXRQ) = 2, D_JE, 0)) As M02,
Sum(IIF(Month(D_SXRQ) = 3, D_JE, 0)) As M03,
Sum(IIF(Month(D_SXRQ) = 4, D_JE, 0)) As M04,
Sum(IIF(Month(D_SXRQ) = 5, D_JE, 0)) As M05,
Sum(IIF(Month(D_SXRQ) = 6, D_JE, 0)) As M06,
Sum(IIF(Month(D_SXRQ) = 7, D_JE, 0)) As M07,
Sum(IIF(Month(D_SXRQ) = 8, D_JE, 0)) As M08,
Sum(IIF(Month(D_SXRQ) = 9, D_JE, 0)) As M09,
Sum(IIF(Month(D_SXRQ) = 10, D_JE, 0)) As M10,
Sum(IIF(Month(D_SXRQ) = 11, D_JE, 0)) As M11,
Sum(IIF(Month(D_SXRQ) = 12, D_JE, 0)) As M12
From D_FY
Group By Year(D_SXRQ);
相关文章
- 光遇12.23每日任务怎么做 光遇12月23日每日任务做法攻略 12-23
- 光遇12.23大蜡烛在哪里 光遇12月23日大蜡烛位置攻略 12-23
- 光遇12.23免费魔法有什么 光遇12月23日免费魔法收集攻略 12-23
- 《流放之路2》寻找熔炉任务攻略分享 12-23
- 《流放之路2》德雷文打法技巧分享 12-23
- 《流放之路2》永恒裁判者德雷文具体位置介绍 12-23