我的輸入數據如下所示 - 在此示例中,如何將表1轉換爲表2,其中第一行分爲3?我怎樣才能然後打開表2到表3,其中我總結3行到1和如何將SQL中的1行變爲多行,然後求和
表1
Task |Month1 |Month1 plan in % |Month2 plan in % |Month3 plan in %
-----------+-------+-----------------+-----------------+----------------
Data entry |Jun-17 |40 |40 |20
Processing |Jul-17 |30 |70
Delivery |Aug-17 |70 |30
表2
Task |Year |Month |% work planned
------------+-------+-----------+--------------
Data entry |2017 |June |40
Data entry |2017 |July |40
Data entry |2017 |August |20
Processing |2017 |July |30
Processing |2017 |August |70
Delivery |2017 |August |70
Delivery |2017 |September |30
表3
Task |Year |Month |Total % work completed
------------+-------+-------+----------------------
Data entry |2017 |July |80
Processing |2017 |July |30
Delivery |2017 |July |0
Data entry |2017 |August |100
Processing |2017 |August |100
Delivery |2017 |August |70
你應該選擇一個問題或其他。 –
你正在使用哪些DBMS?什麼版本?請在問題中添加相關標籤。 –