ROUND((SUM(CASE WHEN EXTRACT(YEAR FROM SB.SKSSQQ) = '2022' THEN YBNSE.YNSR END) OVER() - SUM(CASE WHEN EXTRACT(YEAR FROM SB.SKSSQQ) = '2021' THEN YBNSR.YNSE END) OVER()) / SUM(CASE WHEN EXTRACT(YEAR FROM SB.SKSSQQ) = '2021' THEN YBNSR.YNSE END) OVER() * 100, 2) YNSEBDL 请模拟一下这段代码
时间: 2024-01-16 22:02:45 浏览: 45
假设有如下数据:
| SB.SKSSQQ | YBNSE.YNSR | YBNSR.YNSE |
|-----------|------------|------------|
| 2021-01-01 | 100 | 100 |
| 2021-02-01 | 200 | 300 |
| 2022-01-01 | 150 | 200 |
则运行这段代码的结果为:
```
ROUND((SUM(CASE WHEN EXTRACT(YEAR FROM SB.SKSSQQ) = '2022' THEN YBNSE.YNSR END) OVER() - SUM(CASE WHEN EXTRACT(YEAR FROM SB.SKSSQQ) = '2021' THEN YBNSR.YNSE END) OVER()) / SUM(CASE WHEN EXTRACT(YEAR FROM SB.SKSSQQ) = '2021' THEN YBNSR.YNSE END) OVER() * 100, 2) YNSEBDL
= ROUND((150 - 400) / 400 * 100, 2)
= ROUND(-62.5, 2)
= -62.5
```
因此,假设有以上数据,这段代码的运行结果为-62.5。
阅读全文