我尝试了以下SQL查询,根据PowerPivot手册中的说明将数据从数据库加载到PowerPivot模型:
SELECT
Production_Product.Name AS Product,
Production_ProductCategory.Name AS Category,
Production_ProductSubcategory.Name AS SubCategory
FROM
Production_Product
LEFT OUTER JOIN Production_ProductSubcategory
ON Production_Product.ProductSubcategoryID = Production_ProductSubcategory.ProductSubcategoryID
LEFT OUTER JOIN Production_ProductCategory
ON Production_ProductSubcategory.ProductCategoryID = Production_ProductCategory.ProductCategoryID
不幸的是它不断抛出语法错误(缺少运算符),我找不到出错的地方。它只与一个(第一个)内连接完美配合。
答案 0 :(得分:0)
由于您尚未指定RDBMS,我认为它是MS Access
因为查询的语法是标准SQL,并且对于除MS访问之外的所有RDBMS都是正确的,因为您必须在Access中用括号括起几个LEFT JOIN
SELECT
Production_Product.Name AS Product,
Production_ProductCategory.Name AS Category,
Production_ProductSubcategory.Name AS SubCategory
FROM
((Production_Product
LEFT OUTER JOIN Production_ProductSubcategory
ON Production_Product.ProductSubcategoryID = Production_ProductSubcategory.ProductSubcategoryID)
LEFT OUTER JOIN Production_ProductCategory
ON Production_ProductSubcategory.ProductCategoryID = Production_ProductCategory.ProductCategoryID)