我有两个表:
表1:
+---------------+--------+--------+--------+--------+--------+--------+--------+--------+
| Category | Name | Goal | WK40 | WK41 | WK42 | WK43 | WK44 | WK 45 |
+---------------+--------+--------+--------+--------+--------+--------+--------+--------+
| Data | Data | Data | Data | Data | Data | Data | Data | Data |
+---------------+--------+--------+--------+--------+--------+--------+--------+--------+
表2:
+-------+--------+--------+--------+--------+-------+
| W1 | W2 | W3 | W4 | W5 | W6 |
+-------+--------+--------+--------+--------+-------+
| WK40 | WK41 | WK42 | WK43 | WK44 | WK45 |
+-------+--------+--------+--------+--------+-------+
在表1中,WK40,WK41等列名称是动态的(即,这些列名称每周会根据一年中的当前一周更改一次,然后显示最近的6周)。表1列出了所有必需的数据。
在表2中,列名称为W1,W2,... W6,此处的列名称为静态。但是每列(WK40,WK41 ....)中的数据每周都会根据当前星期更改。
我想创建一个像这样的表:
+---------------+--------+--------+--------+--------+--------+--------+--------+---------+
| Category | Name | Goal | W1 | W2 | W3 | W4 | W5 | W6 |
+---------------+--------+--------+--------+--------+--------+--------+--------+---------+
| Data | Data | Data | Data | Data | Data | Data | Data | Data |
+---------------+--------+--------+--------+--------+--------+--------+--------+---------+
我之前从未使用过PIVOT,因此需要帮助来创建它。谢谢。