我有查询
select distinct
EnglishProductCategoryName,
sum(isnull(fic.SalesAmount,0))InternetSalesAmount,
sum(isnull(frs.SalesAmount,0))ResellerSalesAmount
from dimproduct dp join DimProductSubcategory dps on dp.ProductSubcategoryKey=dps.ProductSubcategoryKey
join DimProductCategory dpc on dpc.ProductCategoryKey=dps.ProductCategoryKey
left join FactInternetSales fic on fic.ProductKey=dp.ProductKey
left join FactResellerSales frs on frs.ProductKey= dp.ProductKey
group by EnglishProductCategoryName
但是当我这样做时
select sum(isnull(fis.SalesAmount,0))InternetSalesAmount from FactInternetSales
select sum(isnull(frs.SalesAmount,0))resellerSalesAmount from FactResellerSales
并比较整个英文产品类别名称和互联网销售金额的总和,经销商销售金额应该相同但不相同
将获得帮助 谢谢
检查是否缺少产品子类别或产品类别
select distinct
EnglishProductCategoryName,
sum(isnull(fic.SalesAmount,0))InternetSalesAmount,
sum(isnull(frs.SalesAmount,0))ResellerSalesAmount
from dimproduct dp left join DimProductSubcategory dps on dp.ProductSubcategoryKey=dps.ProductSubcategoryKey
left join DimProductCategory dpc on dpc.ProductCategoryKey=dps.ProductCategoryKey
left join FactInternetSales fic on fic.ProductKey=dp.ProductKey
left join FactResellerSales frs on frs.ProductKey= dp.ProductKey
group by EnglishProductCategoryName