我有以下視圖。我需要查看每個日期的每個PartNum所指示的總和。但是視圖返回一個不正確的數據集,只顯示某些日期。有人能讓我挺身而出嗎?使用總和返回部分或不正確的數據集
SELECT
`archived_items`.`ArcPartNumber` AS `PartNum`,
`archived_header`.`AhDeliveryDate` AS `DeliveryDate`,
`archived_items`.`ArcTransactionNumber` AS `TransactionNumber`,
sum(`archived_items`.`ArcOrdered`) AS `Ordered`,
sum(`archived_items`.`ArcShipped`) AS `Shipped`,
sum(`archived_items`.`ArcBackOrdered`) AS `BackOrdered`
FROM
(`archived_items`
LEFT JOIN `archived_header` ON (
(`archived_header`.`AhTransactionNumber` = `archived_items`.`ArcTransactionNumber`
)))
WHERE
((`archived_items`.`ArcTransactionType` = 3)
AND
(`archived_header`.`AhDeliveryDate` >= CURDATE()))
GROUP BY
`archived_items`.`ArcPartNumber`
`archived_header`.`AhDeliveryDate`,
ORDER BY
`archived_items`.`ArcPartNumber`,
`archived_header`.`AhDeliveryDate`
感謝您的嘗試。相同的結果。這真的很奇怪。 – AlphaBase
這不是視圖。還有其他的錯誤。再次感謝你的幫助。 – AlphaBase