执行sql查询后我有这个选择结果
+-----------+-------+-----------+
| COL1 | COL2 | COL3 |
+-----------+-------+-----------+
| project1 | FAM1 | 1250.251 |
| project1 | FAM2 | 2145.325 |
| project2 | FAM1 | 2146.152 |
| project2 | FAM2 | NULL |
| project3 | FAM1 | NULL |
| project3 | FAM2 | 1248.002 |
| project4 | FAM1 | NULL |
| project4 | FAM2 | NULL |
| project5 | FAM1 | 3201.684 |
| project5 | FAM2 | 7325.981 |
我想转换为这种格式
+-----------+-----------+-------------+-----------+
| COL1 | FAM1 | FAM2 |COL3 |
+-----------+-----------+-------------+-----------+
| project1 | 1250.251 | 2145.325 | 3395.576 |
| project2 | 2146.152 | 0.0 | 2146.152 |
| project3 | 0.0 | 1248.002 | 1248.002 |
| project4 | 0.0 | 0.0 | 0.0 |
| project5 | 3201.684 | 7325.981 | 10527.665 |
使用我们的冗余将COL2转换为多个colomn,COL3是FAM1和&的总和。 FAM2