我有下表
__________________________________________________________
| | | | | |
|OpeningAmount|PeriodicAmount|ClosingAmount|Years | Month |
-----------------------------------------------------------
| 10000 | 100 | 9900 | 2014 | 1 |
| 99000 | 100 | 9800 | 2014 | 2 |
| 98000 | 100 | 9700 | 2014 | 3 |
| 97000 | 100 | 9600 | 2014 | 4 |
| 10000 | 100 | 9900 | 2015 | 1 |
| 99000 | 100 | 9800 | 2015 | 2 |
| 98000 | 100 | 9700 | 2015 | 3 |
| 97000 | 100 | 9600 | 2015 | 4 |
-----------------------------------------------------------
我需要关注表格
____(MAX)_______(SUM)___________(MIN)_____________
| | | | |
|OpeningAmount|PeriodicAmount|ClosingAmount|Years |
---------------------------------------------------
| 10000 | 400 | 9600 | 2014 |
| 10000 | 400 | 9600 | 2015 |
---------------------------------------------------
请帮我在Mysql中处理它
答案 0 :(得分:0)
select max(OpeningAmount),sum(PeriodicAmount),min(ClosingAmount),Years
from YOUR_TABLE_NAME_GOES_HERE group by Years;
答案 1 :(得分:0)
select max(OpeningAmount),
SUM(PeriodicAmount),
MIN(ClosingAmount),
Years
from MyTable
GROUP BY
Years