TRANSFORM访问SQL到SQL Server

时间:2017-05-04 18:58:36

标签: sql-server ms-access

我在MS Access中遇到了一个我从未见过的语句,并且不知道如何转换为SQL Server或者它正在做什么 - 任何人都可以告诉我这是做什么以及可能我将如何转换成SQL Server?

TRANSFORM Sum([Fcst/Order/Ship Data].Qty) AS SumOfQty
SELECT [Fcst/Order/Ship Data].[Acct Name], [Fcst/Order/Ship Data].[Acct#], [Fcst/Order/Ship Data].Material, [Fcst/Order/Ship Data].Mth
FROM [Fcst/Order/Ship Data]
WHERE ((([Fcst/Order/Ship Data].Year)=2017) AND (([Fcst/Order/Ship Data].Type)="Open_allocated" Or ([Fcst/Order/Ship Data].Type)="shipment" Or ([Fcst/Order/Ship Data].Type)="forecast"))
GROUP BY [Fcst/Order/Ship Data].[Acct Name], [Fcst/Order/Ship Data].[Acct#], [Fcst/Order/Ship Data].Material, [Fcst/Order/Ship Data].Mth
PIVOT [Fcst/Order/Ship Data].Type;

1 个答案:

答案 0 :(得分:0)

转换应使用pivot作为查询结果中的列标题的值,以格式(excel类型)的形式显示结果。

请参阅TRANSFORM Statement (Microsoft Access SQL)