我希望有人可以提供帮助。我有一个包含数百个项目的excel文件,如下表所示,它显示了Style的颜色/大小以及它的QTY级别。但我需要获取相应的标题大小,并将其与样式和颜色以及它的QTY级别相匹配。然后将其格式化为每一行,然后然后复制与每列对应的样式,颜色,长度和价格。我有excel和sql,如果一个更容易使用,那么另一个。
所以基本上就是这样:
+--------+----------+--------+-------+---------+--------+--------+--------+--------+--------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
| STYLE# | COLOR | LENGTH | Price | Size 00 | Size 0 | Size 2 | Size 4 | Size 6 | Size 8 | Size 10 | Size 12 | Size 14 | Size 16 | Size 18 | Size 20 | Size 22 | Size 24 | Size 26 | Size 28 | Size 30 | Size 32 |
+--------+----------+--------+-------+---------+--------+--------+--------+--------+--------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
| 710 | PURPLE | RL | 199 | 0 | 0 | 0 | 2 | 5 | 5 | 5 | 4 | 4 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 710 | DP CORAL | RL | 199 | 0 | 0 | 2 | 0 | 1 | 2 | 1 | 3 | 1 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 720 | RED | RL | 225 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 720 | NAVY | RL | 225 | 0 | 0 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
+--------+----------+--------+-------+---------+--------+--------+--------+--------+--------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
并将其转换为:
+--------+----------+---------+-----+--------+-------+
| STYLE# | COLOR | Size | QTY | LENGTH | Price |
+--------+----------+---------+-----+--------+-------+
| 710 | PURPLE | Size 00 | 0 | RL | 199 |
| 710 | PURPLE | Size 0 | 0 | RL | 199 |
| 710 | PURPLE | Size 2 | 0 | RL | 199 |
| 710 | PURPLE | Size 4 | 2 | RL | 199 |
| 710 | PURPLE | Size 6 | 5 | RL | 199 |
| 710 | PURPLE | Size 8 | 5 | RL | 199 |
| 710 | PURPLE | Size 10 | 5 | RL | 199 |
| 710 | PURPLE | Size 12 | 4 | RL | 199 |
| 710 | PURPLE | Size 14 | 4 | RL | 199 |
| 710 | PURPLE | Size 16 | 3 | RL | 199 |
| 710 | PURPLE | Size 18 | 0 | RL | 199 |
| 710 | PURPLE | Size 20 | 0 | RL | 199 |
| 710 | PURPLE | Size 22 | 0 | RL | 199 |
| 710 | PURPLE | Size 24 | 0 | RL | 199 |
| 710 | PURPLE | Size 26 | 0 | RL | 199 |
| 710 | PURPLE | Size 28 | 0 | RL | 199 |
| 710 | PURPLE | Size 30 | 0 | RL | 199 |
| 710 | PURPLE | Size 32 | 0 | RL | 199 |
| 710 | DP CORAL | Size 00 | 0 | RL | 199 |
| 710 | DP CORAL | Size 0 | 0 | RL | 199 |
| 710 | DP CORAL | Size 2 | 2 | RL | 199 |
| 710 | DP CORAL | Size 4 | 0 | RL | 199 |
| 710 | DP CORAL | Size 6 | 1 | RL | 199 |
| 710 | DP CORAL | Size 8 | 2 | RL | 199 |
| 710 | DP CORAL | Size 10 | 1 | RL | 199 |
| 710 | DP CORAL | Size 12 | 3 | RL | 199 |
| 710 | DP CORAL | Size 14 | 1 | RL | 199 |
| 710 | DP CORAL | Size 16 | 3 | RL | 199 |
| 710 | DP CORAL | Size 18 | 1 | RL | 199 |
| 710 | DP CORAL | Size 20 | 0 | RL | 199 |
| 710 | DP CORAL | Size 22 | 0 | RL | 199 |
| 710 | DP CORAL | Size 24 | 0 | RL | 199 |
| 710 | DP CORAL | Size 26 | 0 | RL | 199 |
| 710 | DP CORAL | Size 28 | 0 | RL | 199 |
| 710 | DP CORAL | Size 30 | 0 | RL | 199 |
| 710 | DP CORAL | Size 32 | 0 | RL | 199 |
| 710 | DP CORAL | Size 00 | 0 | RL | 199 |
| 720 | RED | Size 0 | 0 | RL | 225 |
| 720 | RED | Size 2 | 1 | RL | 225 |
| 720 | RED | Size 4 | 0 | RL | 225 |
| 720 | RED | Size 6 | 0 | RL | 225 |
| 720 | RED | Size 8 | 0 | RL | 225 |
| 720 | RED | Size 10 | 1 | RL | 225 |
| 720 | RED | Size 12 | 0 | RL | 225 |
| 720 | RED | Size 14 | 0 | RL | 225 |
| 720 | RED | Size 16 | 0 | RL | 225 |
| 720 | RED | Size 18 | 0 | RL | 225 |
| 720 | RED | Size 20 | 0 | RL | 225 |
| 720 | RED | Size 22 | 0 | RL | 225 |
| 720 | RED | Size 24 | 0 | RL | 225 |
| 720 | RED | Size 26 | 0 | RL | 225 |
| 720 | RED | Size 28 | 0 | RL | 225 |
| 720 | RED | Size 30 | 0 | RL | 225 |
| 720 | RED | Size 32 | 0 | RL | 225 |
| 720 | NAVY | Size 00 | 0 | RL | 225 |
| 720 | NAVY | Size 0 | 0 | RL | 225 |
| 720 | NAVY | Size 2 | 0 | RL | 225 |
| 720 | NAVY | Size 4 | 1 | RL | 225 |
| 720 | NAVY | Size 6 | 0 | RL | 225 |
| 720 | NAVY | Size 8 | 1 | RL | 225 |
| 720 | NAVY | Size 10 | 2 | RL | 225 |
| 720 | NAVY | Size 12 | 0 | RL | 225 |
| 720 | NAVY | Size 14 | 0 | RL | 225 |
| 720 | NAVY | Size 16 | 0 | RL | 225 |
| 720 | NAVY | Size 18 | 0 | RL | 225 |
| 720 | NAVY | Size 20 | 0 | RL | 225 |
| 720 | NAVY | Size 22 | 0 | RL | 225 |
| 720 | NAVY | Size 24 | 0 | RL | 225 |
| 720 | NAVY | Size 26 | 0 | RL | 225 |
| 720 | NAVY | Size 28 | 0 | RL | 225 |
| 720 | NAVY | Size 30 | 0 | RL | 225 |
| 720 | NAVY | Size 32 | 0 | RL | 225 |
+--------+----------+---------+-----+--------+-------+
对此的任何帮助将不胜感激。
答案 0 :(得分:0)
在SQL中你可以做这样的事情我想(对不起,我有点生疏)..
SELECT style, color, size, qty, length price,
FROM table_name
ORDER BY style DESC, color, size DESC, qty DESC, length, price;
答案 1 :(得分:0)
在excel中,您可以执行此步骤(因为我认为这是快捷方式):
在sql server中,您可以使用关键字 Pivot 和 Unpivot 这个链接可以帮助你:
答案 2 :(得分:0)
我能够通过使用excel并加入颜色,价格来确定我需要什么,然后使用分隔每个值的管道分隔符将相应的大小添加到每个数量级别。然后垂直移调,然后使用excel中的文本到列功能将所有内容分开。