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".
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.