Bug #4530 | a query using sum() reports wrong total | ||
---|---|---|---|
Submitted: | 13 Jul 2004 1:17 | Modified: | 13 Aug 2004 11:08 |
Reporter: | Derek Miller | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.0.20 and 4.0.18 | OS: | Linux (linux) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[13 Jul 2004 1:17]
Derek Miller
[13 Jul 2004 11:08]
Hartmut Holzgraefe
> SELECT s.shipment_id, sum(b.weight) > FROM shipment as s, box as b, inventory as i > Where s.shipment_id = b.shipment_id AND s.shipment_id = 5 > group by s.shipment_id You're missing a join to the inventory table here so it is expected behavior that you get the cartesian product of all shipments by all inventory entries. You're original query looks fine though, but it is hard to tell what is going wrong without seeing the data it operates on ...
[14 Feb 2005 22:54]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".