【发布时间】:2021-12-25 05:29:04
【问题描述】:
我无法取消透视此表。我不断收到两个表不存在的错误。我正在使用 Microsoft SQL Server Management Studio。以下是错误。
type Small_Bags Large_Bags
conventional 8603.6201171875 93.25
conventional 9408.0703125 97.4899978637695
conventional 8042.2099609375 103.139999389648
conventional 5677.39990234375 133.759994506836
conventional 5986.259765625 197.690002441406
conventional 6556.47021484375 127.440002441406
消息 207,第 16 级,状态 1,第 74 行 列名“Small_Bags”无效。 消息 207,第 16 层,状态 1,第 74 行 列名“Large_Bags”无效
select type,Small_Bags,Large_Bags from avocado
unpivot
(
amount
for category in (Small_Bags,Large_Bags)
) as unpivotexample
【问题讨论】:
-
1.
MS-SQL还是MySQL? - 请标记正确的 DBMS 2. 请提供示例输入数据和预期输出。
标签: sql sql-server pivot unpivot