簡體   English   中英

如何根據身分證件和財政年度計算價值

[英]How to club values according to their ids and Financial Year

我在這樣的表中有數據

id fy1 int1 fy2 int2 fy3 int3
_ __ _ __ __ _ _ _ __ __ _ __ _ __ __ _ _ _ __ __ _ __ _ __ __ _ _ _ __ __ _ __ _ __ __ _ _ _ __ __ __ _

1 2013-2014 9167 2014-2015 1183 2015-2016 3002
1 2013-2014 10744 2014-2015 1345 2015-2016 2709
1 2014年-2015年1758年2015年-2016年2347年

我想在FY匹配特定ID的地方加入興趣。

我希望我的數據采用如下所示的形式**

** id fy1 int1 fy2 int2 fy3 int3
_ __ _ __ __ _ _ _ __ __ _ __ _ __ __ _ _ _ __ __ _ __ _ __ __ _ _ _ __ __ _ __ _ __ __ _ _ _ __ __ __ _

1 2013年至2014年19911年2014年至2015年4286 2015年至2016年8058

SELECT id,fy1,SUM(int1) as int1,fy2,SUM(int2) as int2,fy3,SUM(int3) as int3
FROM tablename
GROUP BY id,fy1,fy2,fy3

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM