前几个月和之后的总和

时间:2019-07-29 01:04:09

标签: mysql

在我的SSRS报告中,我可以选择月和年。 示例2019和5月

我必须展示

+---+-----------------------+----------------------------------------------+-------------------------------------------+
| A | May 2019 Month Budget | Sum of all budget from Jan to April for 2019 | Sum of all budget from June till Dec 2019 |
+---+-----------------------+----------------------------------------------+-------------------------------------------+
| B |                       |                                              |                                           |
+---+-----------------------+----------------------------------------------+-------------------------------------------+
| C |                       |                                              |                                           |
+---+-----------------------+----------------------------------------------+-------------------------------------------+
  

数据是从2005年到2030年的。   年。

我尝试了“总计运行”,但没有帮助。 我正在考虑编写一个存储过程,它将为我提供此输出。

还有其他方法吗?

+---------+-------+------+--------+
| Project | MONTH | YEAR | Budget |
+---------+-------+------+--------+
| A       | May   | 2019 |   1472 |
| B       | June  | 2019 |   1800 |
| C       | July  | 2019 |   3217 |
| D       | DEC   | 2019 |   3342 |
| A       | May   | 2018 |   2133 |
| B       | June  | 2018 |   2313 |
| C       | July  | 2018 |   2424 |
| D       | DEC   | 2018 |   2292 |
| A       | May   | 2017 |   3444 |
| B       | June  | 2017 |   2715 |
| C       | July  | 2017 |   2164 |
| D       | DEC   | 2017 |   2930 |
| A       | May   | 2020 |   1439 |
| B       | June  | 2020 |   2008 |
| C       | July  | 2020 |   1355 |
| D       | DEC   | 2020 |   3326 |
+---------+-------+------+--------+


A     May 2019 Month Budget     Sum of all budget from Jan to April for 2019        Sum of all budget from June till Dec 2019
B
C

0 个答案:

没有答案