2
我將我的SQL查詢結果與我的SSRS報告的結果進行比較,結果與其數據集上的查詢相同,但我注意到SSRS與SQL比較結果較差。SSRS結果與SSMS結果不同,查詢相同
我測試了很多次,並確保我在我的報告中選擇了相同的參數,並在我的SQL查詢中輸入了相同的值,但我仍然沒有得到相同的結果。誰能幫我這個?我真的看不到問題。我也檢查過我的SSRS報告中的所有過濾器,但我沒有過濾任何對象。
SELECT ZR.CURRENT_PROD_SKU AS PRODUCT_SKU
,LGEO.LEVEL6 AS CUSTOMER_COUNTRY
,LGEO.LEVEL1 AS CUSTOMER_REGION
,ZR.BILLTO_IBR_CSR_ENTITY_NAME AS CUSTOMER_NAME
,ZR.CURRENTPRODATT_DIV_NAME AS PROD_DIV
,LDATE.PER_NAME_MONTH
,SUM(ZR.RPTDPOSRECORDUNITSSOLD) AS QUANTITY
,SUM(ZR.PRICEC_EUR) AS PRICEC_EUR
FROM View_ZR_Birst_Raw ZR
LEFT JOIN LOOKUP_DATE LDATE ON ZR.POS_INVOICE_DATE = LDATE.DAY_DT
LEFT JOIN LOOKUP_GEO_MASTER LGEO ON LGEO.COUNTRY = ZR.BILLTO_IBR_CSR_COUNTRY
WHERE ZR.POS_INVOICE_DATE BETWEEN @StartDate AND @EndDate
AND LGEO.LEVEL6 IN (SELECT VALUE FROM DBO.[FnSplit](@Country,','))
AND ZR.CURRENTPRODATT_DIV_NAME IN (SELECT VALUE FROM DBO.[FnSplit](@ProductDivision,','))
AND ZR.CURRENT_PROD_SKU IN (SELECT VALUE FROM DBO.[FnSplit](@SKU,','))
GROUP BY ZR.CURRENT_PROD_SKU
,LDATE.PER_NAME_MONTH
,LGEO.LEVEL6
,LGEO.LEVEL1
,ZR.BILLTO_IBR_CSR_ENTITY_NAME
,ZR.CURRENTPRODATT_DIV_NAME
ORDER BY CUSTOMER_REGION,CUSTOMER_COUNTRY,BILLTO_IBR_CSR_ENTITY_NAME,PROD_DIV,PRODUCT_SKU
OPTION (MAXDOP 4)
我在我的WHERE子句中使用了[FnSplit]函數。這個函數基本上是用於從多選參數中分割逗號分隔的值,因爲我的腳本最初是在SP中,所以這就是我使用它的原因。