我有以下看法。我需要查看每个日期的每个 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`